require "GasterAnim"
require "Undertale HP"

Arena.MoveToAndResize(320, -5, 640, 480, true, true)
NewAudio.CreateChannel("Song")
NewAudio.CreateChannel("Gaster")
NewAudio.PlaySound("Song", "Dark Darker Yet Darker Remix", false, 0.5)
NewAudio.PlaySound("Gaster", "Distorsion", true, 0)
NewAudio.Pause("Song")
SetPPCollision(true)
Player.lv = 1
Player.hp = 20
BlackD = CreateSprite("Pixel", "Top")
BlackD.color = {0,0,0}
BlackD.Scale(640, 480)
BlackD.MoveTo(320, 240)
BlackD.alpha = 0

timer = 0
tableaux = 0
hits = 0
phase = 0
phase2 = 0
phase3 = 0
PosX = 320
PosY = 240
Empezar = 210
Invertir = ""

Windings = {}
Warnings = {}
Hands = {}
Circulo = {}
ManosSiguiendo = {}
Manos = {}
Glitches = {}
GlitchesSpiral = {}
Puños = {}
PuñosSpam = {}
Letters = {"a","b","c","d","e","f","g","h"}

function Update()
	if not Pause then
		AnimGaster()
		SongTime = NewAudio.GetPlayTime("Song")
		timer = timer + 1
		if timer > 60 and timer <= 90 then
			if not TituloSong then
				TituloSong = CreateSprite("Gaster Level/Song","Top")
				VersionLevel = CreateSprite("Gaster Level/Version","Top")
				Advice = CreateSprite("Advice "..GetAlMightyGlobal("Idioma"),"BelowPlayer")
				Advice.MoveTo(320, 240)
				VersionLevel.color = {0.5,0.5,0.5}
				Advice.color = {0.75,0.75,0.75}
			end
			TituloSong.MoveTo(556 - 100*math.sin(math.rad(90/30*(timer - 60))), 58)
			TituloSong.alpha = 1/30*(timer - 60)
			VersionLevel.MoveTo(-45.5 + 100*math.sin(math.rad(90/30*(timer - 60))), 17.5)
			VersionLevel.alpha = 1/30*(timer - 60)
			Advice.alpha = 1/30*(timer - 60)
		elseif timer > 210 and timer <= 240 then	
			if timer == 211 then
				NewAudio.Unpause("Song")
				Start = true
				SpawnMeter(234.96)
			end
			TituloSong.MoveTo(456 + 100/30*(timer - 210), 58)
			TituloSong.alpha = 1 - 1/30*(timer - 210)
			VersionLevel.MoveTo(54.5 - 100*math.sin(math.rad(90/30*(timer - 210))), 17.5)
			VersionLevel.alpha = 1 - 1/30*(timer - 210)
			Advice.alpha = 1 - 1/30*(timer - 210)
			if timer == 240 then
				TituloSong.Remove()
				TituloSong = nil
				VersionLevel.Remove()
				VersionLevel = nil
				Advice.Remove()
				Advice = nil
			end
		end
		if Start then
			if NewAudio.GetPlayTime("Song") > 0 and NewAudio.GetPlayTime("Song") <= 5.45 and timer%8 == 0 then
				table.insert(Windings, {Bullet = CreateProjectileAbs("Gaster Level/Misiles/wingdings/"..Letters[math.random(#Letters)], -8, math.random(8, 472)), Direction = 0})
				table.insert(Windings, {Bullet = CreateProjectileAbs("Gaster Level/Misiles/wingdings/"..Letters[math.random(#Letters)], 648, math.random(8, 472)), Direction = 180})
			elseif NewAudio.GetPlayTime("Song") > 5.45 and NewAudio.GetPlayTime("Song") <= 5.66 then
				Distorsion(true, 1, 0.75)
				for i=1,#Windings do
					Windings[i - tableaux].Bullet.Remove()
					Windings[i - tableaux].Bullet = nil
					table.remove(Windings, i - tableaux)
					tableaux = tableaux + 1
				end
				tableaux = 0
				phase = 1
			elseif NewAudio.GetPlayTime("Song") > 5.66 and phase == 1 then
				Distorsion(false)
				Alpha(0.3, 2)
				table.insert(Hands, {Bullet = CreateProjectileAbs("Gaster Level/Misiles/gasterhand", 0, 0), Aim = "Y", Location = "Left", SpawnTimer = 44, Bullets = 2, Rotation = 0})
				table.insert(Hands, {Bullet = CreateProjectileAbs("Gaster Level/Misiles/gasterhandr", 0, 0), Aim = "Y", Location = "Right", SpawnTimer = 44, Timer = 22, Bullets = 2, Rotation = 0})
				phase = 2
			elseif (NewAudio.GetPlayTime("Song") > 5.55 and phase == 2) or (NewAudio.GetPlayTime("Song") > 5.92 and phase == 3) or (NewAudio.GetPlayTime("Song") > 6.27 and phase == 4) or (NewAudio.GetPlayTime("Song") > 6.62 and phase == 5) or
			(NewAudio.GetPlayTime("Song") > 8.39 and phase == 6) or (NewAudio.GetPlayTime("Song") > 8.74 and phase == 7) or (NewAudio.GetPlayTime("Song") > 9.11 and phase == 8) or (NewAudio.GetPlayTime("Song") > 9.46 and phase == 9) or (NewAudio.GetPlayTime("Song") > 9.65 and phase == 10) or
			(NewAudio.GetPlayTime("Song") > 11.23 and phase == 11) or (NewAudio.GetPlayTime("Song") > 11.58 and phase == 12) or (NewAudio.GetPlayTime("Song") > 11.92 and phase == 13) or (NewAudio.GetPlayTime("Song") > 12.29 and phase == 14) or
			(NewAudio.GetPlayTime("Song") > 14.04 and phase == 15) or (NewAudio.GetPlayTime("Song") > 14.42 and phase == 16) or (NewAudio.GetPlayTime("Song") > 14.76 and phase == 17) or (NewAudio.GetPlayTime("Song") > 16.08 and phase == 18) then
				if phase <= 17 then
					table.insert(Glitches, {Bullet = CreateProjectileAbs("Gaster Level/Misiles/Distortion/1", math.random(30, 610), math.random(30, 450)), WarnTime = 90, Bullets = 6})
				else
					for i=1,#Hands do
						Hands[i].Stop = Hands[i].Timer
					end
				end
				phase = phase + 1
			elseif NewAudio.GetPlayTime("Song") > 16.95 and phase == 19 then
				Distorsion(true, 1, 0.75)
				for i=1,#Windings do
					Windings[i - tableaux].Bullet.Remove()
					Windings[i - tableaux].Bullet = nil
					table.remove(Windings, i - tableaux)
					tableaux = tableaux + 1
				end
				tableaux = 0
				phase = 20
			elseif NewAudio.GetPlayTime("Song") > 17.15 and phase == 20 then
				Distorsion(false)
				Player.sprite.rotation = 180
				Invertir = "Y"
				PosY = PosY - (PosY - 240)*2
				CuerpoG.MoveTo(320, 270)
				CabezaG.MoveTo(310, 150)
				CuerpoG.StopAnimation()
				CabezaG.StopAnimation()
				CuerpoG.Set("Gaster Level/Gaster/Cuerpo/NormalR")
				CabezaG.Set("Gaster Level/Gaster/Cabezas/PrimeraR")
				FrameCabeza = "PrimeraR"
				table.insert(Hands, {Bullet = CreateProjectileAbs("Gaster Level/Misiles/gasterhandr", 0, 0), Aim = "Y", Location = "Left", SpawnTimer = 44, Bullets = 3, Rotation = 180})
				table.insert(Hands, {Bullet = CreateProjectileAbs("Gaster Level/Misiles/gasterhand", 0, 0), Aim = "Y", Location = "Right", SpawnTimer = 44, Timer = 22, Bullets = 3, Rotation = 180})
				phase = 21
			elseif NewAudio.GetPlayTime("Song") > 22.26 and phase == 21 then
				for i=1,#Hands do
					Hands[i].Stop = Hands[i].Timer
				end
				phase = 22
			elseif NewAudio.GetPlayTime("Song") > 22.61 and phase == 22 then
				Distorsion(true, 1, 0.75)
				for i=1,#Windings do
					Windings[i - tableaux].Bullet.Remove()
					Windings[i - tableaux].Bullet = nil
					table.remove(Windings, i - tableaux)
					tableaux = tableaux + 1
				end
				tableaux = 0
				phase = 23
			elseif NewAudio.GetPlayTime("Song") > 22.81 and phase == 23 then
				Distorsion(false)
				Alpha(0.3, 2)
				Player.sprite.rotation = 0
				Invertir = "X"
				PosY = PosY - (PosY - 240)*2
				PosX = PosX - (PosX - 320)*2
				CabezaG.MoveTo(330, 330)
				CuerpoG.rotation = 180
				CabezaG.rotation = 180
				table.insert(Hands, {Bullet = CreateProjectileAbs("Gaster Level/Misiles/gasterhand", 0, 0), Aim = "Y", Location = "Left", SpawnTimer = 44, Timer = 22, Bullets = 3, Rotation = 0})
				table.insert(Hands, {Bullet = CreateProjectileAbs("Gaster Level/Misiles/gasterhandr", 0, 0), Aim = "Y", Location = "Right", SpawnTimer = 44, Bullets = 3, Rotation = 0})
				phase = 24
			elseif NewAudio.GetPlayTime("Song") > 27.89 and phase == 24 then
				for i=1,#Hands do
					Hands[i].Stop = Hands[i].Timer
				end
				phase = 25
			elseif NewAudio.GetPlayTime("Song") > 28.24 and phase == 25 then
				Distorsion(true, 1, 0.75)
				for i=1,#Windings do
					Windings[i - tableaux].Bullet.Remove()
					Windings[i - tableaux].Bullet = nil
					table.remove(Windings, i - tableaux)
					tableaux = tableaux + 1
				end
				tableaux = 0
				phase = 26
			elseif NewAudio.GetPlayTime("Song") > 28.44 and phase == 26 then
				Distorsion(false)
				Alpha(0.3, 1.2)
				Invertir = ""
				CabezaG.StopAnimation()
				CuerpoG.rotation = 0
				CabezaG.rotation = 0
				PosY = 240
				PosX = 320
				CuerpoG.StopAnimation()
				CabezaG.StopAnimation()
				CuerpoG.Set("Gaster Level/Gaster/Cuerpo/Normal")
				CabezaG.Set("Gaster Level/Gaster/Cabezas/Normal")
				FrameCabeza = "Normal"
				phase = 27
				for i=1,8 do
					table.insert(Circulo, {Sprite = CreateSprite("Gaster Level/Misiles/gasterhand","BelowPlayer"), Color = {0.3,0.3,0.3}, Centro = {X = 320, Y = 240}, Longitud = 200, Movimiento = {Longitud = 20, Duracion = 120}, Rotation = 45*i, Vel = 0.5})
				end
			elseif (NewAudio.GetPlayTime("Song") > 28.61 and phase == 27) or (NewAudio.GetPlayTime("Song") > 28.94 and phase == 28) or (NewAudio.GetPlayTime("Song") > 29.3 and phase == 29) or (NewAudio.GetPlayTime("Song") > 29.67 and phase == 30) or (NewAudio.GetPlayTime("Song") > 30.02 and phase == 31) or (NewAudio.GetPlayTime("Song") > 30.37 and phase == 32) or
			(NewAudio.GetPlayTime("Song") > 33.56 and phase == 35) or (NewAudio.GetPlayTime("Song") > 33.71 and phase == 36) or (NewAudio.GetPlayTime("Song") > 33.9 and phase == 37) or (NewAudio.GetPlayTime("Song") > 34.25 and phase == 38) or (NewAudio.GetPlayTime("Song") > 34.53 and phase == 39) or (NewAudio.GetPlayTime("Song") > 34.95 and phase == 40) or (NewAudio.GetPlayTime("Song") > 35.3 and phase == 41) or (NewAudio.GetPlayTime("Song") > 35.66 and phase == 42) or (NewAudio.GetPlayTime("Song") > 36.02 and phase == 43) then
				oldrandomizador = randomizador or 0
				repeat
					randomizador = math.random(#Circulo)
				until randomizador ~= oldrandomizador
				Circulo[randomizador].Generar = 8
				if phase == 30 or phase == 41 then
					for i=1,#Circulo do
						Circulo[i].Warning = true
					end
				end
				phase = phase + 1
			elseif (NewAudio.GetPlayTime("Song") > 31.07 and phase == 33) or (NewAudio.GetPlayTime("Song") > 36.72 and phase == 44) then
				for i=1,#Circulo do
					Circulo[i].Warning = nil
					Circulo[i].Detener = nil
					Circulo[i].Spam = true
					Circulo[i].Vel = 0.2
				end
				randomizador = nil
				phase = phase + 1
			elseif (NewAudio.GetPlayTime("Song") > 32.48 and phase == 34) or (NewAudio.GetPlayTime("Song") > 38.14 and phase == 45) then
				for i=1,#Circulo do
					Circulo[i].Vel = 0.5
					Circulo[i].Detener = true
				end
				phase = phase + 1
			elseif NewAudio.GetPlayTime("Song") > 39.16 and phase == 46 then
				Distorsion(true, 1, 0.75)
				for i=1,#Windings do
					Windings[i - tableaux].Bullet.Remove()
					Windings[i - tableaux].Bullet = nil
					table.remove(Windings, i - tableaux)
					tableaux = tableaux + 1
				end
				tableaux = 0
				phase = 47
			elseif NewAudio.GetPlayTime("Song") > 39.36 and phase == 47 then
				Distorsion(false)
				Player.sprite.rotation = 180
				Invertir = "Y"
				PosY = 240
				PosX = 320
				CuerpoG.MoveTo(320, 246)
				CabezaG.MoveTo(310, 174)
				CuerpoG.StopAnimation()
				CabezaG.StopAnimation()
				CuerpoG.Set("Gaster Level/Gaster/Cuerpo/NormalR")
				CabezaG.Set("Gaster Level/Gaster/Cabezas/NormalR")
				FrameCabeza = "NormalR"
				for i=1,#Circulo do
					Circulo[i].Sprite.Set("Gaster Level/Misiles/gasterhandr")
					Circulo[i].Vel = -0.5
				end
				randomizador = nil
				phase = 48
			elseif (NewAudio.GetPlayTime("Song") > 39.53 and phase == 48) or (NewAudio.GetPlayTime("Song") > 39.88 and phase == 49) or (NewAudio.GetPlayTime("Song") > 40.26 and phase == 50) or (NewAudio.GetPlayTime("Song") > 40.6 and phase == 51) or (NewAudio.GetPlayTime("Song") > 40.96 and phase == 52) or (NewAudio.GetPlayTime("Song") > 41.3 and phase == 53) or (NewAudio.GetPlayTime("Song") > 41.63 and phase == 54) or (NewAudio.GetPlayTime("Song") > 42.02 and phase == 55) or
			(NewAudio.GetPlayTime("Song") > 44.84 and phase == 58) or (NewAudio.GetPlayTime("Song") > 45.01 and phase == 59) or (NewAudio.GetPlayTime("Song") > 45.20 and phase == 60) or (NewAudio.GetPlayTime("Song") > 45.55 and phase == 61) or (NewAudio.GetPlayTime("Song") > 45.93 and phase == 62) or (NewAudio.GetPlayTime("Song") > 46.25 and phase == 63) or (NewAudio.GetPlayTime("Song") > 46.62 and phase == 64) or (NewAudio.GetPlayTime("Song") > 46.95 and phase == 65) or (NewAudio.GetPlayTime("Song") > 47.32 and phase == 66) or (NewAudio.GetPlayTime("Song") > 47.67 and phase == 67) then
				oldrandomizador = randomizador or 0
				repeat
					randomizador = math.random(#Circulo)
				until randomizador ~= oldrandomizador
				Circulo[randomizador].Generar = 6
				if phase == 52 or phase == 64 then
					for i=1,#Circulo do
						Circulo[i].Warning = true
					end
				end
				phase = phase + 1
			elseif (NewAudio.GetPlayTime("Song") > 42.36 and phase == 56) or (NewAudio.GetPlayTime("Song") > 48.02 and phase == 68) then
				for i=1,#Circulo do
					Circulo[i].Warning = nil
					Circulo[i].Detener = nil
					Circulo[i].Spam = true
					Circulo[i].Vel = -0.2
				end
				randomizador = nil
				phase = phase + 1
			elseif (NewAudio.GetPlayTime("Song") > 43.79 and phase == 57) or (NewAudio.GetPlayTime("Song") > 49.44 and phase == 69) then
				for i=1,#Circulo do
					Circulo[i].Vel = -0.5
					Circulo[i].Detener = true
				end
				phase = phase + 1
			elseif NewAudio.GetPlayTime("Song") > 50.8 and phase == 70 then
				Distorsion(true, 1, 0.75)
				for i=1,#Circulo do
					Circulo[i - tableaux].Sprite.Remove()
					Circulo[i - tableaux].Sprite = nil
					table.remove(Circulo, i - tableaux)
					tableaux = tableaux + 1
				end
				tableaux = 0
				for i=1,#Windings do
					Windings[i - tableaux].Bullet.Remove()
					Windings[i - tableaux].Bullet = nil
					table.remove(Windings, i - tableaux)
					tableaux = tableaux + 1
				end
				tableaux = 0
				phase = 71
			elseif NewAudio.GetPlayTime("Song") > 51 and phase == 71 then
				Alpha(0.3, 2)
				ConvulsionG = 2
				Player.sprite.rotation = 180
				Invertir = "Y"
				PosY = 240
				PosX = 320
				CuerpoG.MoveTo(320, 270)
				CabezaG.MoveTo(310, 150)
				phase = 72
			elseif NewAudio.GetPlayTime("Song") > 51 and NewAudio.GetPlayTime("Song") <= 56.1 and timer%8 == 0 then
				Distorsion(true, 0.1 + 0.1*math.random(3), 0)
				table.insert(Windings, {Bullet = CreateProjectileAbs("Gaster Level/Misiles/wingdings/"..Letters[math.random(#Letters)], -8, math.random(8, 472)), Direction = 0})
				table.insert(Windings, {Bullet = CreateProjectileAbs("Gaster Level/Misiles/wingdings/"..Letters[math.random(#Letters)], 648, math.random(8, 472)), Direction = 180})
			elseif NewAudio.GetPlayTime("Song") > 56.1 and phase == 72 then
				Distorsion(true, 1, 0.75)
				for i=1,#Circulo do
					Circulo[i - tableaux].Sprite.Remove()
					Circulo[i - tableaux].Sprite = nil
					table.remove(Circulo, i - tableaux)
					tableaux = tableaux + 1
				end
				tableaux = 0
				for i=1,#Windings do
					Windings[i - tableaux].Bullet.Remove()
					Windings[i - tableaux].Bullet = nil
					table.remove(Windings, i - tableaux)
					tableaux = tableaux + 1
				end
				tableaux = 0
				phase = 73
			elseif NewAudio.GetPlayTime("Song") > 56.3 and phase == 73 then
				Distorsion(true, 0.1*math.random(2), 0)
				Alpha(0.3, 2)
				Player.sprite.rotation = 0
				Invertir = ""
				ConvulsionG = 1
				PosY = 240
				PosX = 320
				CuerpoG.StopAnimation()
				CabezaG.StopAnimation()
				CuerpoG.Set("Gaster Level/Gaster/Cuerpo/Normal")
				CabezaG.Set("Gaster Level/Gaster/Cabezas/Normal")
				FrameCabeza = "Normal"
				phase = 74
			elseif NewAudio.GetPlayTime("Song") > 57.166 + 0.361*(phase - 74) and phase >= 74 and phase < 131 then
				Distorsion(true, 0.1*math.random(2), 0)
				if phase >= 74 then
					table.insert(Glitches, {Bullet = CreateProjectileAbs("Gaster Level/Misiles/Distortion/1", math.random(30, 610), math.random(30, 450)), WarnTime = 90, Bullets = 5})
				end
				if phase == 75 or phase == 83 or phase == 91 or phase == 98 or phase == 106 or phase == 114 or phase == 122 then
					local Glitch = {Bullet = CreateProjectileAbs("Gaster Level/Misiles/Distortion Circular/1", math.random(100, 540), math.random(100, 380)), WarnTime = 120, Bullets = 12}
					Glitch.Bullet.sprite.Scale(1.5, 1.5)
					table.insert(GlitchesSpiral, Glitch)
				end
				phase = phase + 1
			elseif NewAudio.GetPlayTime("Song") > 78.91 and phase == 131 then
				Distorsion(true, 1, 0.75)
				for i=1,#Windings do
					Windings[i - tableaux].Bullet.Remove()
					Windings[i - tableaux].Bullet = nil
					table.remove(Windings, i - tableaux)
					tableaux = tableaux + 1
				end
				tableaux = 0
				for i=1,#Glitches do
					Glitches[i - tableaux].Bullet.Remove()
					Glitches[i - tableaux].Bullet = nil
					table.remove(Glitches, i - tableaux)
					tableaux = tableaux + 1
				end
				tableaux = 0
				for i=1,#GlitchesSpiral do
					GlitchesSpiral[i - tableaux].Bullet.Remove()
					GlitchesSpiral[i - tableaux].Bullet = nil
					table.remove(GlitchesSpiral, i - tableaux)
					tableaux = tableaux + 1
				end
				tableaux = 0
				phase = 132
			elseif NewAudio.GetPlayTime("Song") > 79.11 and phase == 132 then
				Distorsion(false)
				CuerpoG.rotation = 180
				CabezaG.rotation = 180
				CabezaG.MoveTo(329, 330)
				Invertir = "X"
				PosX = 320
				CuerpoG.StopAnimation()
				CabezaG.StopAnimation()
				CuerpoG.Set("Gaster Level/Gaster/Cuerpo/NormalR")
				CabezaG.Set("Gaster Level/Gaster/Cabezas/PrimeraR")
				FrameCabeza = "PrimeraR"
				phase = 133
			elseif NewAudio.GetPlayTime("Song") > 79.11 and NewAudio.GetPlayTime("Song") <= 84.52 and timer%8 == 0 then
				Distorsion(true, 0.4/2.78*math.max(NewAudio.GetPlayTime("Song") - 81.94, 0), 0)
				table.insert(Windings, {Bullet = CreateProjectileAbs("Gaster Level/Misiles/wingdings/"..Letters[math.random(#Letters)], -8, math.random(8, 472)), Direction = 0, Acceleration = true})
				table.insert(Windings, {Bullet = CreateProjectileAbs("Gaster Level/Misiles/wingdings/"..Letters[math.random(#Letters)], 648, math.random(8, 472)), Direction = 180, Acceleration = true})
			elseif NewAudio.GetPlayTime("Song") > 84.52 and phase == 133 then
				Distorsion(true, 1, 0.75)
				Alpha(0.3, 2)
				Invertir = "Y"
				PosX = 320
				PosY = 240
				ConvulsionG = 3
				Player.sprite.rotation = 180
				CuerpoG.rotation = 0
				CabezaG.rotation = 0
				CuerpoG.MoveTo(320, 270)
				CabezaG.MoveTo(329, 150)
				CuerpoG.StopAnimation()
				CabezaG.StopAnimation()
				CuerpoG.Set("Gaster Level/Gaster/Cuerpo/NormalR")
				CabezaG.Set("Gaster Level/Gaster/Cabezas/EmocionadoR")
				FrameCabeza = "EmocionadoR"
				for i=1,#Windings do
					Windings[i - tableaux].Bullet.Remove()
					Windings[i - tableaux].Bullet = nil
					table.remove(Windings, i - tableaux)
					tableaux = tableaux + 1
				end
				tableaux = 0
				for i=1,6 do
					table.insert(Manos, {Bullet = CreateProjectileAbs("Gaster Level/Misiles/gasterhand", 0, 0), MovimientoX = {Longitud = 6, Duracion = 90}, MovimientoY = {Longitud = 20, Duracion = 180}, X = 20, Y = -40 + 80*i, Rotation = 0, Timer = 10*i})
					table.insert(Manos, {Bullet = CreateProjectileAbs("Gaster Level/Misiles/gasterhand", 0, 0), MovimientoX = {Longitud = -6, Duracion = 90}, MovimientoY = {Longitud = -20, Duracion = 180}, X = 620, Y = -40 + 80*i, Rotation = 180, Timer = 10*i})
				end
				phase = 134
			elseif NewAudio.GetPlayTime("Song") > 84.72 and phase >= 134 and phase < 195 then
				Distorsion(true, 0.1*math.random(2), 0)
				if NewAudio.GetPlayTime("Song") > 84.72 + 0.37*(phase - 134) then
					Manos[math.random(#Manos)].Generar = 3
					if phase == 134 or phase == 137 or phase == 141 or phase == 145 or phase == 149 or phase == 153 or phase == 157 or phase == 161 or phase == 164 or phase == 168 or phase == 172 or phase == 176 or phase == 180 or phase == 183 or phase == 187 or phase == 191 then
						oldrandomizador = randomizador or 0
						repeat
							randomizador = math.random(#Manos)
						until oldrandomizador ~= randomizador
						oldrandomizador2 = randomizador2 or 0
						repeat
							randomizador2 = math.random(#Manos)
						until oldrandomizador2 ~= randomizador2 and randomizador2 ~= randomizador
						oldrandomizador3 = randomizador3 or 0
						repeat
							randomizador3 = math.random(#Manos)
						until oldrandomizador3 ~= randomizador3 and randomizador3 ~= randomizador2 and randomizador3 ~= randomizador
						Manos[randomizador].Warning = true
						Manos[randomizador2].Warning = true
						Manos[randomizador3].Warning = true
					end
					phase = phase + 1
				elseif (NewAudio.GetPlayTime("Song") > 85.55 and phase < 138) or (NewAudio.GetPlayTime("Song") > 86.98 and phase < 142) or (NewAudio.GetPlayTime("Song") > 88.38 and phase < 146) or (NewAudio.GetPlayTime("Song") > 89.78 and phase < 150) or (NewAudio.GetPlayTime("Song") > 91.21 and phase < 154) or (NewAudio.GetPlayTime("Song") > 92.62 and phase < 158) or (NewAudio.GetPlayTime("Song") > 94.05 and phase < 162) or (NewAudio.GetPlayTime("Song") > 95.45 and phase < 165) or (NewAudio.GetPlayTime("Song") > 96.86 and phase < 169) or (NewAudio.GetPlayTime("Song") > 98.28 and phase < 173) or (NewAudio.GetPlayTime("Song") > 99.69 and phase < 177) or (NewAudio.GetPlayTime("Song") > 101.08 and phase < 181) or (NewAudio.GetPlayTime("Song") > 102.49 and phase < 184) or (NewAudio.GetPlayTime("Song") > 103.91 and phase < 188) or (NewAudio.GetPlayTime("Song") > 105.32 and phase < 192) or (NewAudio.GetPlayTime("Song") > 106.73 and phase < 196) then
					Manos[randomizador].Warning = nil
					Manos[randomizador2].Warning = nil
					Manos[randomizador3].Warning = nil
					Manos[randomizador].Detener = true
					Manos[randomizador2].Detener = true
					Manos[randomizador3].Detener = true
				elseif (NewAudio.GetPlayTime("Song") > 85.25 and phase < 138) or (NewAudio.GetPlayTime("Song") > 86.68 and phase < 142) or (NewAudio.GetPlayTime("Song") > 88.08 and phase < 146) or (NewAudio.GetPlayTime("Song") > 89.48 and phase < 150) or (NewAudio.GetPlayTime("Song") > 90.91 and phase < 154) or (NewAudio.GetPlayTime("Song") > 92.32 and phase < 158) or (NewAudio.GetPlayTime("Song") > 93.75 and phase < 162) or (NewAudio.GetPlayTime("Song") > 95.15 and phase < 165) or (NewAudio.GetPlayTime("Song") > 96.56 and phase < 169) or (NewAudio.GetPlayTime("Song") > 97.98 and phase < 173) or (NewAudio.GetPlayTime("Song") > 99.39 and phase < 177) or (NewAudio.GetPlayTime("Song") > 100.78 and phase < 181) or (NewAudio.GetPlayTime("Song") > 102.19 and phase < 184) or (NewAudio.GetPlayTime("Song") > 103.61 and phase < 188) or (NewAudio.GetPlayTime("Song") > 105.02 and phase < 192) or (NewAudio.GetPlayTime("Song") > 106.43 and phase < 196) then
					Manos[randomizador].Warning = nil
					Manos[randomizador2].Warning = nil
					Manos[randomizador3].Warning = nil
					Manos[randomizador].Detener = nil
					Manos[randomizador2].Detener = nil
					Manos[randomizador3].Detener = nil
					Manos[randomizador].Spam = true
					Manos[randomizador2].Spam = true
					Manos[randomizador3].Spam = true
				end
			elseif NewAudio.GetPlayTime("Song") > 106.95 and phase == 195 then
				for i=1,#Manos do
					Manos[i - tableaux].Bullet.Remove()
					Manos[i - tableaux].Bullet = nil
					table.remove(Manos, i - tableaux)
					tableaux = tableaux + 1
				end
				tableaux = 0
				for i=1,#Windings do
					Windings[i - tableaux].Bullet.Remove()
					Windings[i - tableaux].Bullet = nil
					table.remove(Windings, i - tableaux)
					tableaux = tableaux + 1
				end
				tableaux = 0
				Black = CreateSprite("Pixel","Top")
				Black.color = {0,0,0}
				Black.Scale(640, 480)
				Black.MoveTo(320, 240)
				Heart = CreateSprite("Gaster Level/Corazon Roto","Top")
				Heart.rotation = 180
				Heart.color = Player.sprite.color
				Heart.MoveTo(PosX, PosY)
				phase = 196
			elseif NewAudio.GetPlayTime("Song") > 107.28 and phase == 196 then
				Black.Remove()
				Heart.Remove()
				Black = nil
				Heart = nil
				Distorsion(true, 1, 0.75)
				Alpha(0.3, 2)
				phase = 197
			elseif NewAudio.GetPlayTime("Song") > 107.58 and phase == 197 then
				Distorsion(false)
				ConvulsionG = 1
				Invertir = ""
				Player.sprite.rotation = 0
				CuerpoG.StopAnimation()
				CabezaG.StopAnimation()
				CuerpoG.Set("Gaster Level/Gaster/Cuerpo/Normal")
				CabezaG.Set("Gaster Level/Gaster/Cabezas/Normal")
				FrameCabeza = "Normal"
				PosX = 320
				PosY = 240
				for i=1,8 do
					table.insert(Manos, {Bullet = CreateProjectileAbs("Gaster Level/Misiles/gasterhand", 0, 0), MovimientoX = {Longitud = 6, Duracion = 90}, MovimientoY = {Longitud = 10, Duracion = 180}, X = -40 + 80*i, Y = 20, Rotation = 90, Timer = 10*i})
				end
				for i=1,8 do
					table.insert(Manos, {Bullet = CreateProjectileAbs("Gaster Level/Misiles/gasterhand", 0, 0), MovimientoX = {Longitud = -6, Duracion = 90}, MovimientoY = {Longitud = -10, Duracion = 180}, X = -40 + 80*i, Y = 460, Rotation = 270, Timer = 10*i})
				end
				phase = 198
				phase2 = 1
			elseif NewAudio.GetPlayTime("Song") > 107.58 + 0.355*(phase - 198) and phase >= 198 and phase < 257 then
				table.insert(Glitches, {Bullet = CreateProjectileAbs("Gaster Level/Misiles/Distortion/1", math.random(30, 610), math.random(80, 400)), WarnTime = 90, Bullets = 4})
				phase = phase + 1
			elseif NewAudio.GetPlayTime("Song") > 128.61 + 1.38*(phase - 257) and phase >= 257 and phase < 265 then
				repeat
					Glitch = {Bullet = CreateProjectileAbs("Gaster Level/Misiles/Distortion Circular/1", math.random(100, 540), math.random(100, 380)), WarnTime = 90, Bullets = 8}
					if Glitch.Bullet.absx > 200 and Glitch.Bullet.absx < 440 and Glitch.Bullet.absy > 120 and Glitch.Bullet.absy < 360 then
						Glitch.Bullet.Remove()
						Glitch.Bullet = nil
					end
				until Glitch.Bullet
				Glitch.Bullet.sprite.Scale(1.5, 1.5)
				table.insert(GlitchesSpiral, Glitch)
				phase = phase + 1
			elseif NewAudio.GetPlayTime("Song") > 141.4 and phase == 265 then
				Distorsion(false)
				Alpha(0.2, 2)
				ConvulsionG = 2
				Invertir = ""
				PosX = 320
				PosY = 240
				CuerpoG.rotation = 0
				CabezaG.rotation = 0
				CuerpoG.StopAnimation()
				CabezaG.StopAnimation()
				CuerpoG.Set("Gaster Level/Gaster/Cuerpo/Normal")
				CabezaG.Set("Gaster Level/Gaster/Cabezas/Normal")
				FrameCabeza = "Normal"
				for i=1,2 do
					table.insert(ManosSiguiendo, {Bullet = CreateProjectileAbs("Gaster Level/Misiles/gasterhand", 0, 0), Longitud = 140, Movimiento = {Longitud = 10, Duracion = 120}, Rotation = 180*i, Vel = 1})
				end
				phase = 266
			elseif NewAudio.GetPlayTime("Song") > 142.02 + 2.82/6*(phase - 266) and phase >= 266 and phase < 362 and phase%6 == 2 then
				for i=1,#ManosSiguiendo do
					ManosSiguiendo[i].Warning = true
				end
				phase = phase + 1
			elseif NewAudio.GetPlayTime("Song") > 142.62 + 2.82/6*(phase - 267) and phase >= 267 and phase < 362 and phase%6 == 3 then
				for i=1,#ManosSiguiendo do
					ManosSiguiendo[i].Warning = nil
					ManosSiguiendo[i].Detener = nil
					ManosSiguiendo[i].Spam = true
				end
				phase = phase + 1
			elseif NewAudio.GetPlayTime("Song") > 142.97 + 2.82/6*(phase - 268) and phase >= 268 and phase < 362 and phase%6 == 4 then
				for i=1,#ManosSiguiendo do
					ManosSiguiendo[i].Detener = true
				end
				phase = phase + 1
			elseif NewAudio.GetPlayTime("Song") > 143.25 + 2.82/6*(phase - 269) and phase >= 269 and phase < 362 and phase%6 == 5 then
				for i=1,#ManosSiguiendo do
					ManosSiguiendo[i].Warning = true
				end
				phase = phase + 1
			elseif NewAudio.GetPlayTime("Song") > 143.85 + 2.82/6*(phase - 270) and phase >= 270 and phase < 362 and phase%6 == 0 then
				for i=1,#ManosSiguiendo do
					ManosSiguiendo[i].Warning = nil
					ManosSiguiendo[i].Detener = nil
					ManosSiguiendo[i].Spam = true
				end
				phase = phase + 1
			elseif NewAudio.GetPlayTime("Song") > 144.38 + 2.82/6*(phase - 271) and phase >= 271 and phase < 362 and phase%6 == 1 then
				for i=1,#ManosSiguiendo do
					ManosSiguiendo[i].Detener = true
					if phase == 361 then
						ManosSiguiendo[i].Desaparecer = 0
					end
				end
				phase = phase + 1
			elseif NewAudio.GetPlayTime("Song") > 185.39 and NewAudio.GetPlayTime("Song") <= 208.91 then
				if NewAudio.GetPlayTime("Song") > 186.37 then
					Distorsion(true, 0.1*math.random(2), 0)
					ConvulsionG = 3
				end
				if NewAudio.GetPlayTime("Song") > 185.39 + 0.33*(phase - 362) and phase >= 362 and phase < 426 then
					table.insert(Glitches, {Bullet = CreateProjectileAbs("Gaster Level/Misiles/Distortion/1", math.random(30, 610), math.random(30, 450)), WarnTime = 60, Bullets = 4})
					phase = phase + 1
				end
			elseif NewAudio.GetPlayTime("Song") > 208.92 and phase == 426 then
				Distorsion(true, 1, 0.75)
				Alpha(0.2, 2)
				ConvulsionG = 1
				CuerpoG.StopAnimation()
				CabezaG.StopAnimation()
				CuerpoG.Set("Gaster Level/Gaster/Cuerpo/Normal")
				CabezaG.Set("Gaster Level/Gaster/Cabezas/Primera")
				FrameCabeza = "Primera"
				for i=1,#Windings do
					Windings[i - tableaux].Bullet.Remove()
					Windings[i - tableaux].Bullet = nil
					table.remove(Windings, i - tableaux)
					tableaux = tableaux + 1
				end
				tableaux = 0
				PosX = 320
				phase = 427
			elseif NewAudio.GetPlayTime("Song") > 209.12 and NewAudio.GetPlayTime("Song") <= 231.2 and timer%8 == 0 then
				Distorsion(false)
				table.insert(Windings, {Bullet = CreateProjectileAbs("Gaster Level/Misiles/wingdings/"..Letters[math.random(#Letters)], -8, math.random(8, 472)), Direction = 0, Acceleration = true})
				table.insert(Windings, {Bullet = CreateProjectileAbs("Gaster Level/Misiles/wingdings/"..Letters[math.random(#Letters)], 648, math.random(8, 472)), Direction = 180, Acceleration = true})
			end
			if NewAudio.GetPlayTime("Song") > 185.05 + 2.825*phase3 and phase3 >= 0 and phase3 < 8 then
				Glitch = {Bullet = CreateProjectileAbs("Gaster Level/Misiles/Distortion Circular/1", math.random(30, 610), math.random(30, 450)), WarnTime = 90, Bullets = 14}
				Glitch.Bullet.sprite.Scale(1.5, 1.5)
				table.insert(GlitchesSpiral, Glitch)
				phase3 = phase3 + 1
			elseif NewAudio.GetPlayTime("Song") > 209.02 + 0.7*(phase3 - 8) and phase3 >= 8 and phase3 < 39 and timer%8 == 0 then
				table.insert(Warnings, {Sprite = CreateSprite("Pixel","Top"), Duracion = 24, Direccion = math.random(2)})
				phase3 = phase3 + 1
			end
			if (NewAudio.GetPlayTime("Song") > 107.72 and phase2 == 1) or (NewAudio.GetPlayTime("Song") > 110.55 and phase2 == 10) or (NewAudio.GetPlayTime("Song") > 113.38 and phase2 == 19) or (NewAudio.GetPlayTime("Song") > 116.2 and phase2 == 28) or (NewAudio.GetPlayTime("Song") > 119.03 and phase2 == 37) or (NewAudio.GetPlayTime("Song") > 121.85 and phase2 == 46) or (NewAudio.GetPlayTime("Song") > 124.67 and phase2 == 55) or (NewAudio.GetPlayTime("Song") > 127.5 and phase2 == 64) then
				randomizador = math.random(#Manos)
				repeat
					randomizador2 = math.random(#Manos)
				until randomizador2 ~= randomizador
				Manos[randomizador].Warning = true
				Manos[randomizador2].Warning = true
				Manos[randomizador].Detener = nil
				Manos[randomizador2].Detener = nil
				phase2 = phase2 + 1
			elseif (NewAudio.GetPlayTime("Song") > 108.08 and phase2 == 2) or (NewAudio.GetPlayTime("Song") > 110.91 and phase2 == 11) or (NewAudio.GetPlayTime("Song") > 113.73 and phase2 == 20) or (NewAudio.GetPlayTime("Song") > 116.55 and phase2 == 29) or (NewAudio.GetPlayTime("Song") > 119.37 and phase2 == 38) or (NewAudio.GetPlayTime("Song") > 122.2 and phase2 == 47) or (NewAudio.GetPlayTime("Song") > 125.03 and phase2 == 56) or (NewAudio.GetPlayTime("Song") > 127.85 and phase2 == 65) then
				repeat
					randomizador3 = math.random(#Manos)
				until randomizador3 ~= randomizador and randomizador3 ~= randomizador2
				repeat
					randomizador4 = math.random(#Manos)
				until randomizador4 ~= randomizador and randomizador4 ~= randomizador2 and randomizador4 ~= randomizador3
				Manos[randomizador3].Warning = true
				Manos[randomizador4].Warning = true
				Manos[randomizador3].Detener = nil
				Manos[randomizador4].Detener = nil
				phase2 = phase2 + 1
			elseif (NewAudio.GetPlayTime("Song") > 108.49 and phase2 == 3) or (NewAudio.GetPlayTime("Song") > 111.25 and phase2 == 12) or (NewAudio.GetPlayTime("Song") > 114.08 and phase2 == 21) or (NewAudio.GetPlayTime("Song") > 116.91 and phase2 == 30) or (NewAudio.GetPlayTime("Song") > 119.74 and phase2 == 39) or (NewAudio.GetPlayTime("Song") > 122.55 and phase2 == 48) or (NewAudio.GetPlayTime("Song") > 125.37 and phase2 == 57) or (NewAudio.GetPlayTime("Song") > 128.2 and phase2 == 66) then
				repeat
					randomizador5 = math.random(#Manos)
				until randomizador5 ~= randomizador and randomizador5 ~= randomizador2 and randomizador5 ~= randomizador3 and randomizador5 ~= randomizador4
				repeat
					randomizador6 = math.random(#Manos)
				until randomizador6 ~= randomizador and randomizador6 ~= randomizador2 and randomizador6 ~= randomizador3 and randomizador6 ~= randomizador4 and randomizador6 ~= randomizador5
				Manos[randomizador5].Warning = true
				Manos[randomizador6].Warning = true
				Manos[randomizador5].Detener = nil
				Manos[randomizador6].Detener = nil
				phase2 = phase2 + 1
			elseif (NewAudio.GetPlayTime("Song") > 108.79 and phase2 == 5) or (NewAudio.GetPlayTime("Song") > 111.61 and phase2 == 14) or (NewAudio.GetPlayTime("Song") > 114.44 and phase2 == 23) or (NewAudio.GetPlayTime("Song") > 117.26 and phase2 == 32) or (NewAudio.GetPlayTime("Song") > 120.08 and phase2 == 41) or (NewAudio.GetPlayTime("Song") > 122.91 and phase2 == 50) or (NewAudio.GetPlayTime("Song") > 125.72 and phase2 == 59) or (NewAudio.GetPlayTime("Song") > 128.56 and phase2 == 68) then
				repeat
					randomizador7 = math.random(#Manos)
				until randomizador7 ~= randomizador and randomizador7 ~= randomizador2 and randomizador7 ~= randomizador3 and randomizador7 ~= randomizador4 and randomizador7 ~= randomizador5 and randomizador7 ~= randomizador6
				repeat
					randomizador8 = math.random(#Manos)
				until randomizador8 ~= randomizador and randomizador8 ~= randomizador2 and randomizador8 ~= randomizador3 and randomizador8 ~= randomizador4 and randomizador8 ~= randomizador5 and randomizador8 ~= randomizador6 and randomizador8 ~= randomizador7
				Manos[randomizador7].Warning = true
				Manos[randomizador8].Warning = true
				Manos[randomizador7].Detener = nil
				Manos[randomizador8].Detener = nil
				phase2 = phase2 + 1
			elseif (NewAudio.GetPlayTime("Song") > 108.72 and phase2 == 4) or (NewAudio.GetPlayTime("Song") > 111.55 and phase2 == 13) or (NewAudio.GetPlayTime("Song") > 114.38 and phase2 == 22) or (NewAudio.GetPlayTime("Song") > 117.2 and phase2 == 31) or (NewAudio.GetPlayTime("Song") > 120.03 and phase2 == 40) or (NewAudio.GetPlayTime("Song") > 122.85 and phase2 == 49) or (NewAudio.GetPlayTime("Song") > 125.67 and phase2 == 58) or (NewAudio.GetPlayTime("Song") > 128.5 and phase2 == 67) then
				Manos[randomizador].Warning = nil
				Manos[randomizador].Spam = true
				Manos[randomizador2].Warning = nil
				Manos[randomizador2].Spam = true
				phase2 = phase2 + 1
			elseif (NewAudio.GetPlayTime("Song") > 109.08 and phase2 == 6) or (NewAudio.GetPlayTime("Song") > 111.91 and phase2 == 15) or (NewAudio.GetPlayTime("Song") > 114.73 and phase2 == 24) or (NewAudio.GetPlayTime("Song") > 117.55 and phase2 == 33) or (NewAudio.GetPlayTime("Song") > 120.37 and phase2 == 42) or (NewAudio.GetPlayTime("Song") > 123.2 and phase2 == 51) or (NewAudio.GetPlayTime("Song") > 126.03 and phase2 == 60) or (NewAudio.GetPlayTime("Song") > 128.85 and phase2 == 69) then
				Manos[randomizador].Detener = true
				Manos[randomizador2].Detener = true
				Manos[randomizador3].Warning = nil
				Manos[randomizador3].Spam = true
				Manos[randomizador4].Warning = nil
				Manos[randomizador4].Spam = true
				phase2 = phase2 + 1
			elseif (NewAudio.GetPlayTime("Song") > 109.49 and phase2 == 7) or (NewAudio.GetPlayTime("Song") > 112.25 and phase2 == 16) or (NewAudio.GetPlayTime("Song") > 115.08 and phase2 == 25) or (NewAudio.GetPlayTime("Song") > 117.91 and phase2 == 34) or (NewAudio.GetPlayTime("Song") > 120.74 and phase2 == 43) or (NewAudio.GetPlayTime("Song") > 123.55 and phase2 == 52) or (NewAudio.GetPlayTime("Song") > 126.37 and phase2 == 61) or (NewAudio.GetPlayTime("Song") > 129.2 and phase2 == 70) then
				Manos[randomizador3].Detener = true
				Manos[randomizador4].Detener = true
				Manos[randomizador5].Warning = nil
				Manos[randomizador5].Spam = true
				Manos[randomizador6].Warning = nil
				Manos[randomizador6].Spam = true
				phase2 = phase2 + 1
			elseif (NewAudio.GetPlayTime("Song") > 109.79 and phase2 == 8) or (NewAudio.GetPlayTime("Song") > 112.61 and phase2 == 17) or (NewAudio.GetPlayTime("Song") > 115.44 and phase2 == 26) or (NewAudio.GetPlayTime("Song") > 118.26 and phase2 == 35) or (NewAudio.GetPlayTime("Song") > 121.08 and phase2 == 44) or (NewAudio.GetPlayTime("Song") > 123.91 and phase2 == 53) or (NewAudio.GetPlayTime("Song") > 126.72 and phase2 == 62) or (NewAudio.GetPlayTime("Song") > 129.56 and phase2 == 71) then
				Manos[randomizador5].Detener = true
				Manos[randomizador6].Detener = true
				Manos[randomizador7].Warning = nil
				Manos[randomizador7].Spam = true
				Manos[randomizador8].Warning = nil
				Manos[randomizador8].Spam = true
				phase2 = phase2 + 1
			elseif (NewAudio.GetPlayTime("Song") > 110.08 and phase2 == 9) or (NewAudio.GetPlayTime("Song") > 112.95 and phase2 == 18) or (NewAudio.GetPlayTime("Song") > 115.79 and phase2 == 27) or (NewAudio.GetPlayTime("Song") > 118.61 and phase2 == 36) or (NewAudio.GetPlayTime("Song") > 121.44 and phase2 == 45) or (NewAudio.GetPlayTime("Song") > 124.26 and phase2 == 54) or (NewAudio.GetPlayTime("Song") > 127.08 and phase2 == 63) or (NewAudio.GetPlayTime("Song") > 129.9 and phase2 == 72) then
				Manos[randomizador7].Detener = true
				Manos[randomizador8].Detener = true
				randomizador = nil
				randomizador2 = nil
				randomizador3 = nil
				randomizador4 = nil
				randomizador5 = nil
				randomizador6 = nil
				randomizador7 = nil
				randomizador8 = nil
				if phase2 == 72 then
					Distorsion(true, 1, 0.75)
					Alpha(0.3, 1.2)
					ConvulsionG = 3
					Invertir = "X"
					PosX = 320
					PosY = 240
					CabezaG.MoveTo(320 + 9*1.2, 306)
					CuerpoG.rotation = 180
					CabezaG.rotation = 180
					CuerpoG.StopAnimation()
					CabezaG.StopAnimation()
					CuerpoG.Set("Gaster Level/Gaster/Cuerpo/NormalR")
					CabezaG.Set("Gaster Level/Gaster/Cabezas/EmocionadoR")
					FrameCabeza = "EmocionadoR"
					for i=1,#Manos do
						Manos[i - tableaux].Bullet.Remove()
						Manos[i - tableaux].Bullet = nil
						table.remove(Manos, i - tableaux)
						tableaux = tableaux + 1
					end
					tableaux = 0
					for i=1,#Glitches do
						Glitches[i - tableaux].Bullet.Remove()
						Glitches[i - tableaux].Bullet = nil
						table.remove(Glitches, i - tableaux)
						tableaux = tableaux + 1
					end
					tableaux = 0
					for i=1,#Windings do
						Windings[i - tableaux].Bullet.Remove()
						Windings[i - tableaux].Bullet = nil
						table.remove(Windings, i - tableaux)
						tableaux = tableaux + 1
					end
					tableaux = 0
					for i=1,8 do
						table.insert(Circulo, {Sprite = CreateSprite("Gaster Level/Misiles/gasterhand","BelowPlayer"), Color = {0.3,0.3,0.3}, Centro = {X = 320, Y = 240}, Longitud = 200, Movimiento = {Longitud = 20, Duracion = 120}, Rotation = 45*i, Vel = 0.5})
					end
				end
				phase2 = phase2 + 1
			elseif NewAudio.GetPlayTime("Song") > 130.1 and phase2 >= 73 and phase2 < 103 then
				Distorsion(true, 0.1*math.random(2), 0)
				if NewAudio.GetPlayTime("Song") > 130.27 + 0.35*(phase2 - 73) and phase2 < 102 then
					repeat
						randomizador = math.random(#Circulo)
					until randomizador ~= oldrandomizador
					Circulo[randomizador].Generar = 6
					phase2 = phase2 + 1
				elseif NewAudio.GetPlayTime("Song") > 141.2 and phase2 == 102 then
					Distorsion(true, 1, 0.75)
					for i=1,#Circulo do
						Circulo[i - tableaux].Sprite.Remove()
						Circulo[i - tableaux].Sprite = nil
						table.remove(Circulo, i - tableaux)
						tableaux = tableaux + 1
					end
					tableaux = 0
					for i=1,#GlitchesSpiral do
						GlitchesSpiral[i - tableaux].Bullet.Remove()
						GlitchesSpiral[i - tableaux].Bullet = nil
						table.remove(GlitchesSpiral, i - tableaux)
						tableaux = tableaux + 1
					end
					tableaux = 0
					for i=1,#Windings do
						Windings[i - tableaux].Bullet.Remove()
						Windings[i - tableaux].Bullet = nil
						table.remove(Windings, i - tableaux)
						tableaux = tableaux + 1
					end
					tableaux = 0
					phase2 = 103
					phase = 265
				end
			elseif NewAudio.GetPlayTime("Song") > 141.26 + 0.18*(phase2 - 103) and phase2 >= 103 and phase2 < 222 then
				for i=1,5 do
					table.insert(Glitches, {Bullet = CreateProjectileAbs("Gaster Level/Misiles/Distortion/1", -16 + 32*math.random(20), -16 + 32*math.random(15)), WarnTime = 60, Bullets = 0})
				end
				phase2 = phase2 + 1
			elseif NewAudio.GetPlayTime("Song") > 163.14 + 0.7*(phase2 - 222) and phase2 >= 222 and phase2 < 254 then
				table.insert(Puños, {Bullet = CreateProjectileAbs("Gaster Level/Misiles/gasterfist", math.random(36, 604), math.random(36, 444)), Rotation = 90*math.random(4), Generar = 4})
				phase2 = phase2 + 1
			elseif NewAudio.GetPlayTime("Song") > 185.38 + 1.41*(phase2 - 254) and phase2 >= 254 and phase2 < 270 then
				table.insert(PuñosSpam, {Bullet = CreateProjectileAbs("Gaster Level/Misiles/gasterfist", math.random(36, 604), math.random(36, 444)), Duracion = 74, Rotation = 90*math.random(4), Generar = 1})
				phase2 = phase2 + 1
			elseif NewAudio.GetPlayTime("Song") > 229.2 and phase2 == 270 then
				table.insert(Glitches, {Bullet = CreateProjectileAbs("Gaster Level/Misiles/Distortion/1", 320, 240), WarnTime = 120, Bullets = 30})
				phase2 = 271
			elseif NewAudio.isStopped("Song") and phase2 >= 271 and phase2 < 331 then
				phase2 = phase2 + 1
			elseif NewAudio.isStopped("Song") and phase2 == 331 then
				CabezaG.color = {CabezaG.color[1] - 0.005, CabezaG.color[2] - 0.005, CabezaG.color[3] - 0.005}
				CuerpoG.color = {CuerpoG.color[1] - 0.005, CuerpoG.color[2] - 0.005, CuerpoG.color[3] - 0.005}
				if CabezaG.color[1] <= 0 then
					phase2 = 332
				end
			elseif phase2 >= 332 and phase2 < 392 then
				phase2 = phase2 + 1
			elseif phase2 == 392 then
				CuerpoG.Remove()
				CabezaG.Remove()
				Distortion.Remove()
				CabezaD.Remove()
				NewAudio.Stop("Gaster")
				NewAudio.DestroyChannel("Gaster")
				NewAudio.DestroyChannel("Song")
				for i=1,#Warnings do
					Warnings[i - tableaux].Sprite.Remove()
					table.remove(Warnings, i - tableaux)
					tableaux = tableaux + 1
				end
				tableaux = 0
				for i=1,#Puños do
					if Puños[i - tableaux].Warning then
						Puños[i - tableaux].Warning.Remove()
					end
					table.remove(Puños, i - tableaux)
					tableaux = tableaux + 1
				end
				tableaux = 0
				for i=1,#PuñosSpam do
					if PuñosSpam[i - tableaux].Warning then
						PuñosSpam[i - tableaux].Warning.Remove()
					end
					table.remove(PuñosSpam, i - tableaux)
					tableaux = tableaux + 1
				end
				tableaux = 0
				for i=1,#Circulo do
					Circulo[i - tableaux].Sprite.Remove()
					if Circulo[i - tableaux].SpriteWarn then
						Circulo[i - tableaux].SpriteWarn.Remove()
					end
					table.remove(Circulo, i - tableaux)
					tableaux = tableaux + 1
				end
				tableaux = 0
				for i=1,#Manos do
					if Manos[i - tableaux].SpriteWarn then
						Manos[i - tableaux].SpriteWarn.Remove()
					end
					table.remove(Manos, i - tableaux)
					tableaux = tableaux + 1
				end
				tableaux = 0
				for i=1,#ManosSiguiendo do
					if ManosSiguiendo[i - tableaux].SpriteWarn then
						ManosSiguiendo[i - tableaux].SpriteWarn.Remove()
					end
					table.remove(ManosSiguiendo, i - tableaux)
					tableaux = tableaux + 1
				end
				tableaux = 0
				RemoveAll()
				Encounter["nextwaves"] = {"MenuG"}
				State("ACTIONSELECT")
				State("DEFENDING")
			end
		end
		for i=1,#Warnings do
			local Datos = Warnings[i - tableaux]
			if not Datos.Timer then
				Datos.Timer = 0
				Datos.Sprite.y = math.random(8, 472)
			end
			Datos.Timer = Datos.Timer + 1
			if Datos.Timer <= 60 then
				Datos.Sprite.alpha = (0.65 - 0.35*math.cos(math.rad(180/10*Datos.Timer)))/5
				Datos.Sprite.Scale(640, 16)
				Datos.Sprite.x = 320
			elseif Datos.Timer > 60 and Datos.Timer <= 60 + Datos.Duracion and Datos.Timer%8 == 5 then
				if Datos.Timer == 61 then
					Datos.Sprite.alpha = 0
				end
				if Datos.Direccion == 1 then
					table.insert(Windings, {Bullet = CreateProjectileAbs("Gaster Level/Misiles/wingdings/"..Letters[math.random(#Letters)], -8, Datos.Sprite.y), Direction = 0, Vel = 9})
					table.insert(Windings, {Bullet = CreateProjectileAbs("Gaster Level/Misiles/wingdings/"..Letters[math.random(#Letters)], -8, Datos.Sprite.y), Direction = 0, Vel = 10})
					table.insert(Windings, {Bullet = CreateProjectileAbs("Gaster Level/Misiles/wingdings/"..Letters[math.random(#Letters)], -8, Datos.Sprite.y), Direction = 0, Vel = 11})
					table.insert(Windings, {Bullet = CreateProjectileAbs("Gaster Level/Misiles/wingdings/"..Letters[math.random(#Letters)], -8, Datos.Sprite.y), Direction = 0, Vel = 12})
				else
					table.insert(Windings, {Bullet = CreateProjectileAbs("Gaster Level/Misiles/wingdings/"..Letters[math.random(#Letters)], 648, Datos.Sprite.y), Direction = 180, Vel = 9})
					table.insert(Windings, {Bullet = CreateProjectileAbs("Gaster Level/Misiles/wingdings/"..Letters[math.random(#Letters)], 648, Datos.Sprite.y), Direction = 180, Vel = 10})
					table.insert(Windings, {Bullet = CreateProjectileAbs("Gaster Level/Misiles/wingdings/"..Letters[math.random(#Letters)], 648, Datos.Sprite.y), Direction = 180, Vel = 11})
					table.insert(Windings, {Bullet = CreateProjectileAbs("Gaster Level/Misiles/wingdings/"..Letters[math.random(#Letters)], 648, Datos.Sprite.y), Direction = 180, Vel = 12})
				end
			elseif Datos.Timer > 60 + Datos.Duracion then
				Datos.Sprite.Remove()
				Datos.Sprite = nil
				Datos = nil
				table.remove(Warnings, i - tableaux)
				tableaux = tableaux + 1
			end
		end
		tableaux = 0
		for i=1,#PuñosSpam do
			local Datos = PuñosSpam[i - tableaux]
			if not Datos.Timer then
				Datos.Timer = 0
			end
			Datos.Bullet.sprite.rotation = Datos.Rotation
			Datos.Timer = Datos.Timer + 1
			if Datos.Rotation == 90 then
				if Datos.Timer <= 60 then
					if not Datos.Warning then
						Datos.Warning = CreateSprite("Pixel", "BelowBullet")
						Datos.Warning.Scale(640, 72)
						Datos.Warning.MoveTo(320, Datos.Bullet.absy)
					end
					Datos.Bullet.MoveToAbs(-36 + 20/60*Datos.Timer, Datos.Bullet.absy)
				elseif Datos.Timer > 60 and Datos.Timer <= 70 then
					Datos.Bullet.MoveToAbs(-16 + 630/10*(Datos.Timer - 60), Datos.Bullet.absy)
					Datos.Warning.xscale = 640 - 618/10*(Datos.Timer - 60)
					Datos.Warning.MoveTo(640 - Datos.Warning.xscale/2, Datos.Bullet.absy)
					if Datos.Timer == 70 then
						Datos.Warning.Remove()
						Datos.Warning = nil
						for i=1,Datos.Generar do
							table.insert(Windings, {Bullet = CreateProjectileAbs("Gaster Level/Misiles/wingdings/"..Letters[math.random(#Letters)], Datos.Bullet.absx, Datos.Bullet.absy), Direction = math.random(90, 270), Vel = 3})
						end
					end
				elseif Datos.Timer > 70 and Datos.Timer <= 70 + Datos.Duracion and Datos.Timer%10 == 0 then
					for i=1,Datos.Generar do
						table.insert(Windings, {Bullet = CreateProjectileAbs("Gaster Level/Misiles/wingdings/"..Letters[math.random(#Letters)], Datos.Bullet.absx, Datos.Bullet.absy), Direction = math.random(90, 270), Vel = 3})
					end
				elseif Datos.Timer > 70 + Datos.Duracion and Datos.Timer <= 90 + Datos.Duracion then
					Datos.Bullet.sprite.alpha = 1 - 1/20*(Datos.Timer - (70 + Datos.Duracion))
				end
				if Datos.Warning then
					Datos.Warning.alpha = (0.65 + 0.35*math.cos(math.rad(180/10*Datos.Timer)))/5
				end
			elseif Datos.Rotation == 180 then
				if Datos.Timer <= 60 then
					if not Datos.Warning then
						Datos.Warning = CreateSprite("Pixel", "BelowBullet")
						Datos.Warning.Scale(72, 480)
						Datos.Warning.MoveTo(Datos.Bullet.absx, 240)
					end
					Datos.Bullet.MoveToAbs(Datos.Bullet.absx, -36 + 20/60*Datos.Timer)
				elseif Datos.Timer > 60 and Datos.Timer <= 70 then
					Datos.Bullet.MoveToAbs(Datos.Bullet.absx, -16 + 470/10*(Datos.Timer - 60))
					Datos.Warning.yscale = 480 - 458/10*(Datos.Timer - 60)
					Datos.Warning.MoveTo(Datos.Bullet.absx, 480 - Datos.Warning.yscale/2)
					if Datos.Timer == 70 then
						Datos.Warning.Remove()
						Datos.Warning = nil
						for i=1,Datos.Generar do
							table.insert(Windings, {Bullet = CreateProjectileAbs("Gaster Level/Misiles/wingdings/"..Letters[math.random(#Letters)], Datos.Bullet.absx, Datos.Bullet.absy), Direction = math.random(180, 360), Vel = 3})
						end
					end
				elseif Datos.Timer > 70 and Datos.Timer <= 70 + Datos.Duracion and Datos.Timer%10 == 0 then
					for i=1,Datos.Generar do
						table.insert(Windings, {Bullet = CreateProjectileAbs("Gaster Level/Misiles/wingdings/"..Letters[math.random(#Letters)], Datos.Bullet.absx, Datos.Bullet.absy), Direction = math.random(180, 360), Vel = 3})
					end
				elseif Datos.Timer > 70 + Datos.Duracion and Datos.Timer <= 90 + Datos.Duracion then
					Datos.Bullet.sprite.alpha = 1 - 1/20*(Datos.Timer - (70 + Datos.Duracion))
				end
				if Datos.Warning then
					Datos.Warning.alpha = (0.65 + 0.35*math.cos(math.rad(180/10*Datos.Timer)))/5
				end
			elseif Datos.Rotation == 270 then
				if Datos.Timer <= 60 then
					if not Datos.Warning then
						Datos.Warning = CreateSprite("Pixel", "BelowBullet")
						Datos.Warning.Scale(640, 72)
						Datos.Warning.MoveTo(320, Datos.Bullet.absy)
					end
					Datos.Bullet.MoveToAbs(676 - 20/60*Datos.Timer, Datos.Bullet.absy)
				elseif Datos.Timer > 60 and Datos.Timer <= 70 then
					Datos.Bullet.MoveToAbs(656 - 630/10*(Datos.Timer - 60), Datos.Bullet.absy)
					Datos.Warning.xscale = 640 - 618/10*(Datos.Timer - 60)
					Datos.Warning.MoveTo(Datos.Warning.xscale/2, Datos.Bullet.absy)
					if Datos.Timer == 70 then
						Datos.Warning.Remove()
						Datos.Warning = nil
						for i=1,Datos.Generar do
							table.insert(Windings, {Bullet = CreateProjectileAbs("Gaster Level/Misiles/wingdings/"..Letters[math.random(#Letters)], Datos.Bullet.absx, Datos.Bullet.absy), Direction = math.random(270, 450), Vel = 3})
						end
					end
				elseif Datos.Timer > 70 and Datos.Timer <= 70 + Datos.Duracion and Datos.Timer%10 == 0 then
					for i=1,Datos.Generar do
						table.insert(Windings, {Bullet = CreateProjectileAbs("Gaster Level/Misiles/wingdings/"..Letters[math.random(#Letters)], Datos.Bullet.absx, Datos.Bullet.absy), Direction = math.random(270, 450), Vel = 3})
					end
				elseif Datos.Timer > 70 + Datos.Duracion and Datos.Timer <= 90 + Datos.Duracion then
					Datos.Bullet.sprite.alpha = 1 - 1/20*(Datos.Timer - (70 + Datos.Duracion))
				end
				if Datos.Warning then
					Datos.Warning.alpha = (0.65 + 0.35*math.cos(math.rad(180/10*Datos.Timer)))/5
				end
			elseif Datos.Rotation == 360 then
				if Datos.Timer <= 60 then
					if not Datos.Warning then
						Datos.Warning = CreateSprite("Pixel", "BelowBullet")
						Datos.Warning.Scale(72, 480)
						Datos.Warning.MoveTo(Datos.Bullet.absx, 240)
					end
					Datos.Bullet.MoveToAbs(Datos.Bullet.absx, 516 - 20/60*Datos.Timer)
				elseif Datos.Timer > 60 and Datos.Timer <= 70 then
					Datos.Bullet.MoveToAbs(Datos.Bullet.absx, 496 - 470/10*(Datos.Timer - 60))
					Datos.Warning.yscale = 480 - 458/10*(Datos.Timer - 60)
					Datos.Warning.MoveTo(Datos.Bullet.absx, Datos.Warning.yscale/2)
					if Datos.Timer == 70 then
						Datos.Warning.Remove()
						Datos.Warning = nil
						for i=1,Datos.Generar do
							table.insert(Windings, {Bullet = CreateProjectileAbs("Gaster Level/Misiles/wingdings/"..Letters[math.random(#Letters)], Datos.Bullet.absx, Datos.Bullet.absy), Direction = math.random(0, 180), Vel = 3})
						end
					end
				elseif Datos.Timer > 70 and Datos.Timer <= 70 + Datos.Duracion and Datos.Timer%10 == 0 then
					for i=1,Datos.Generar do
						table.insert(Windings, {Bullet = CreateProjectileAbs("Gaster Level/Misiles/wingdings/"..Letters[math.random(#Letters)], Datos.Bullet.absx, Datos.Bullet.absy), Direction = math.random(0, 180), Vel = 3})
					end
				elseif Datos.Timer > 70 + Datos.Duracion and Datos.Timer <= 90 + Datos.Duracion then
					Datos.Bullet.sprite.alpha = 1 - 1/20*(Datos.Timer - (70 + Datos.Duracion))
				end
				if Datos.Warning then
					Datos.Warning.alpha = (0.65 + 0.35*math.cos(math.rad(180/10*Datos.Timer)))/5
				end
			end
			if Datos.Timer > 100 + Datos.Duracion then
				Datos.Bullet.Remove()
				Datos.Bullet = nil
				Datos = nil
				table.remove(PuñosSpam, i - tableaux)
				tableaux = tableaux + 1
			end
		end
		tableaux = 0
		for i=1,#Puños do
			local Datos = Puños[i - tableaux]
			if not Datos.Timer then
				Datos.Timer = 0
			end
			Datos.Bullet.sprite.rotation = Datos.Rotation
			Datos.Timer = Datos.Timer + 1
			if Datos.Rotation == 90 then
				if Datos.Timer <= 60 then
					if not Datos.Warning then
						Datos.Warning = CreateSprite("Pixel", "BelowBullet")
						Datos.Warning.Scale(640, 72)
						Datos.Warning.MoveTo(320, Datos.Bullet.absy)
					end
					Datos.Bullet.MoveToAbs(-36 + 20/60*Datos.Timer, Datos.Bullet.absy)
				elseif Datos.Timer > 60 and Datos.Timer <= 70 then
					Datos.Bullet.MoveToAbs(-16 + 630/10*(Datos.Timer - 60), Datos.Bullet.absy)
					Datos.Warning.xscale = 640 - 618/10*(Datos.Timer - 60)
					Datos.Warning.MoveTo(640 - Datos.Warning.xscale/2, Datos.Bullet.absy)
					if Datos.Timer == 70 then
						Datos.Warning.Remove()
						Datos.Warning = nil
						local diff = 180/(Datos.Generar - 1)
						local current = 90
						for i=1,Datos.Generar do
							table.insert(Windings, {Bullet = CreateProjectileAbs("Gaster Level/Misiles/wingdings/"..Letters[math.random(#Letters)], Datos.Bullet.absx, Datos.Bullet.absy), Direction = current, Vel = 3})
							current = current + diff
						end
					end
				elseif Datos.Timer > 100 and Datos.Timer <= 120 then
					Datos.Bullet.sprite.alpha = 1 - 1/20*(Datos.Timer - 100)
				end
				if Datos.Warning then
					Datos.Warning.alpha = (0.65 + 0.35*math.cos(math.rad(180/10*Datos.Timer)))/5
				end
			elseif Datos.Rotation == 180 then
				if Datos.Timer <= 60 then
					if not Datos.Warning then
						Datos.Warning = CreateSprite("Pixel", "BelowBullet")
						Datos.Warning.Scale(72, 480)
						Datos.Warning.MoveTo(Datos.Bullet.absx, 240)
					end
					Datos.Bullet.MoveToAbs(Datos.Bullet.absx, -36 + 20/60*Datos.Timer)
				elseif Datos.Timer > 60 and Datos.Timer <= 70 then
					Datos.Bullet.MoveToAbs(Datos.Bullet.absx, -16 + 470/10*(Datos.Timer - 60))
					Datos.Warning.yscale = 480 - 458/10*(Datos.Timer - 60)
					Datos.Warning.MoveTo(Datos.Bullet.absx, 480 - Datos.Warning.yscale/2)
					if Datos.Timer == 70 then
						Datos.Warning.Remove()
						Datos.Warning = nil
						local diff = 180/(Datos.Generar - 1)
						local current = 180
						for i=1,Datos.Generar do
							table.insert(Windings, {Bullet = CreateProjectileAbs("Gaster Level/Misiles/wingdings/"..Letters[math.random(#Letters)], Datos.Bullet.absx, Datos.Bullet.absy), Direction = current, Vel = 3})
							current = current + diff
						end
					end
				elseif Datos.Timer > 100 and Datos.Timer <= 120 then
					Datos.Bullet.sprite.alpha = 1 - 1/20*(Datos.Timer - 100)
				end
				if Datos.Warning then
					Datos.Warning.alpha = (0.65 + 0.35*math.cos(math.rad(180/10*Datos.Timer)))/5
				end
			elseif Datos.Rotation == 270 then
				if Datos.Timer <= 60 then
					if not Datos.Warning then
						Datos.Warning = CreateSprite("Pixel", "BelowBullet")
						Datos.Warning.Scale(640, 72)
						Datos.Warning.MoveTo(320, Datos.Bullet.absy)
					end
					Datos.Bullet.MoveToAbs(676 - 20/60*Datos.Timer, Datos.Bullet.absy)
				elseif Datos.Timer > 60 and Datos.Timer <= 70 then
					Datos.Bullet.MoveToAbs(656 - 630/10*(Datos.Timer - 60), Datos.Bullet.absy)
					Datos.Warning.xscale = 640 - 618/10*(Datos.Timer - 60)
					Datos.Warning.MoveTo(Datos.Warning.xscale/2, Datos.Bullet.absy)
					if Datos.Timer == 70 then
						Datos.Warning.Remove()
						Datos.Warning = nil
						local diff = 180/(Datos.Generar - 1)
						local current = 270
						for i=1,Datos.Generar do
							table.insert(Windings, {Bullet = CreateProjectileAbs("Gaster Level/Misiles/wingdings/"..Letters[math.random(#Letters)], Datos.Bullet.absx, Datos.Bullet.absy), Direction = current, Vel = 3})
							current = current + diff
						end
					end
				elseif Datos.Timer > 100 and Datos.Timer <= 120 then
					Datos.Bullet.sprite.alpha = 1 - 1/20*(Datos.Timer - 100)
				end
				if Datos.Warning then
					Datos.Warning.alpha = (0.65 + 0.35*math.cos(math.rad(180/10*Datos.Timer)))/5
				end
			elseif Datos.Rotation == 360 then
				if Datos.Timer <= 60 then
					if not Datos.Warning then
						Datos.Warning = CreateSprite("Pixel", "BelowBullet")
						Datos.Warning.Scale(72, 480)
						Datos.Warning.MoveTo(Datos.Bullet.absx, 240)
					end
					Datos.Bullet.MoveToAbs(Datos.Bullet.absx, 516 - 20/60*Datos.Timer)
				elseif Datos.Timer > 60 and Datos.Timer <= 70 then
					Datos.Bullet.MoveToAbs(Datos.Bullet.absx, 496 - 470/10*(Datos.Timer - 60))
					Datos.Warning.yscale = 480 - 458/10*(Datos.Timer - 60)
					Datos.Warning.MoveTo(Datos.Bullet.absx, Datos.Warning.yscale/2)
					if Datos.Timer == 70 then
						Datos.Warning.Remove()
						Datos.Warning = nil
						local diff = 180/(Datos.Generar - 1)
						local current = 0
						for i=1,Datos.Generar do
							table.insert(Windings, {Bullet = CreateProjectileAbs("Gaster Level/Misiles/wingdings/"..Letters[math.random(#Letters)], Datos.Bullet.absx, Datos.Bullet.absy), Direction = current, Vel = 3})
							current = current + diff
						end
					end
				elseif Datos.Timer > 100 and Datos.Timer <= 120 then
					Datos.Bullet.sprite.alpha = 1 - 1/20*(Datos.Timer - 100)
				end
				if Datos.Warning then
					Datos.Warning.alpha = (0.65 + 0.35*math.cos(math.rad(180/10*Datos.Timer)))/5
				end
			end
			if Datos.Timer > 130 then
				Datos.Bullet.Remove()
				Datos.Bullet = nil
				Datos = nil
				table.remove(Puños, i - tableaux)
				tableaux = tableaux + 1
			end
		end
		tableaux = 0
		for i=1,#ManosSiguiendo do
			local Datos = ManosSiguiendo[i - tableaux]
			if not Datos.Timer then
				Datos.Timer = 0
			end
			Datos.Timer = Datos.Timer + 1
			Datos.Rotation = Datos.Rotation + Datos.Vel
			Datos.Bullet.MoveToAbs(PosX - (Datos.Longitud + Datos.Movimiento.Longitud*math.sin(math.rad(360/Datos.Movimiento.Duracion*Datos.Timer)))*math.sin(math.rad(Datos.Rotation)), PosY + (Datos.Longitud + Datos.Movimiento.Longitud*math.sin(math.rad(360/Datos.Movimiento.Duracion*Datos.Timer)))*math.cos(math.rad(Datos.Rotation)))
			Datos.Bullet.sprite.rotation = Datos.Rotation + 180
			Datos.Bullet.SendToTop()
			if Datos.Warning then
				if not Datos.AuxW then
					Datos.AuxW = 0
					Datos.SpriteWarn = CreateSprite("Pixel","BelowPlayer")
					Datos.SpriteWarn.Scale(16, 1000)
				end
				Datos.AuxW = Datos.AuxW + 1
				Datos.SpriteWarn.MoveTo(PosX - (Datos.Longitud + Datos.Movimiento.Longitud*math.sin(math.rad(360/Datos.Movimiento.Duracion*Datos.Timer)))*math.sin(math.rad(Datos.Rotation)) + 500*math.sin(math.rad(Datos.Rotation)), PosY + (Datos.Longitud + Datos.Movimiento.Longitud*math.sin(math.rad(360/Datos.Movimiento.Duracion*Datos.Timer)))*math.cos(math.rad(Datos.Rotation)) - 500*math.cos(math.rad(Datos.Rotation)))
				Datos.SpriteWarn.rotation = Datos.Rotation
				Datos.SpriteWarn.alpha = (0.65 - 0.35*math.cos(math.rad(180/10*Datos.AuxW)))/5
			elseif Datos.SpriteWarn then
				Datos.SpriteWarn.Remove()
				Datos.SpriteWarn = nil
				Datos.AuxW = nil
			end
			if Datos.Spam then
				if not Datos.Aux then
					Datos.Aux = 0
					Datos.Limite = 3
				end
				Datos.Aux = Datos.Aux + 1
				Datos.Bullet.sprite.Scale(1 + 0.1*math.sin(math.rad(180/6*math.min(Datos.Aux, Datos.Limite))), 1 + 0.1*math.sin(math.rad(180/6*math.min(Datos.Aux, Datos.Limite))))
				if Datos.Aux >= 3 and not Datos.Detener then
					Datos.Bullet.sprite.rotation = Datos.Rotation + 180 + math.random(-4, 4)
					if Datos.Aux%6 == 3 then
						table.insert(Windings, {Bullet = CreateProjectileAbs("Gaster Level/Misiles/wingdings/"..Letters[math.random(#Letters)], Datos.Bullet.sprite.x, Datos.Bullet.sprite.y), Direction = Datos.Rotation - 90, Vel = 6, Special = true})
					end
				elseif Datos.Limite == 3 and Datos.Detener then
					Datos.Limite = 6
					Datos.Aux = 3
				elseif Datos.Limite == 6 and Datos.Aux >= 6 then
					Datos.Aux = nil
					Datos.Limite = nil
					Datos.Spam = nil
				end
			end
			if Datos.Desaparecer and not Datos.Spam then
				Datos.Desaparecer = Datos.Desaparecer + 1
				if Datos.Desaparecer <= 4 then
					Datos.Bullet.sprite.Scale(1 + 0.2*math.sin(math.rad(90/4*Datos.Desaparecer)), 1 + 0.2*math.sin(math.rad(90/4*Datos.Desaparecer)))
				elseif Datos.Desaparecer > 4 then
					Datos.Bullet.sprite.Scale(1.2 - 1.2*math.sin(math.rad(90/10*(Datos.Desaparecer - 4))), 1.2 - 1.2*math.sin(math.rad(90/10*(Datos.Desaparecer - 4))))
					if Datos.Bullet.sprite.yscale <= 0 then
						Datos.Bullet.Remove()
						Datos.Bullet = nil
						Datos = nil
						table.remove(ManosSiguiendo, i - tableaux)
						tableaux = tableaux + 1
					end
				end
			end
		end
		tableaux = 0
		for i=1,#GlitchesSpiral do
			local Datos = GlitchesSpiral[i - tableaux]
			if not Datos.Timer then
				Datos.Timer = 0
				Datos.Bullet.sprite.alpha = 0
			end
			if not Datos.Position then
				Datos.Position = {X = Datos.Bullet.absx, Y = Datos.Bullet.absy}
			end
			if not Datos.Limit then
				Datos.Limit = 3
			end
			if not Datos.Times then
				Datos.Times = 1
			end
			if Datos.Shake then
				Datos.Bullet.MoveToAbs(Datos.Position.X + math.random(-2, 2), Datos.Position.Y + math.random(-2, 2))
			else
				Datos.Bullet.MoveToAbs(Datos.Position.X, Datos.Position.Y)
			end
			Datos.Timer = Datos.Timer + 1
			if Datos.Timer%9 == 3 then
				Datos.Bullet.sprite.Set("Gaster Level/Misiles/Distortion Circular/1")
			elseif Datos.Timer%9 == 6 then
				Datos.Bullet.sprite.Set("Gaster Level/Misiles/Distortion Circular/2")
			elseif Datos.Timer%9 == 0 then
				Datos.Bullet.sprite.Set("Gaster Level/Misiles/Distortion Circular/3")
			end
			if Datos.Timer < Datos.WarnTime then
				Datos.Bullet.sprite.alpha = 0.5*Datos.Timer/Datos.WarnTime
			else
				Datos.Bullet.sprite.alpha = 0.5 + 0.5/6*(Datos.Timer - Datos.WarnTime)
				Datos.Bullet.sprite.Scale(1.5 + 0.3*math.sin(math.rad(180/6*math.min(Datos.Timer - Datos.WarnTime, Datos.Limit))),1.5 + 0.3*math.sin(math.rad(180/6*math.min(Datos.Timer - Datos.WarnTime, Datos.Limit))))
				if (Datos.Timer - Datos.WarnTime) == 6*Datos.Times then
					Datos.Times = math.min(Datos.Times + 1, Datos.Bullets)
					Datos.diff = 360/Datos.Bullets
					if not Datos.current then
						Datos.current = math.random(360)
					else
						Datos.current = Datos.current + Datos.diff
					end
					if Datos.Times == Datos.Bullets then
						Datos.Limit = 6
						Datos.Shake = nil
					else
						Datos.Shake = true
					end
					table.insert(Windings, {Bullet = CreateProjectileAbs("Gaster Level/Misiles/wingdings/"..Letters[math.random(#Letters)], Datos.Bullet.absx, Datos.Bullet.absy), Direction = Datos.current, Vel = 3})
				elseif (Datos.Timer - Datos.WarnTime) >= 20 + 6*Datos.Bullets then
					Datos.Bullet.sprite.Scale(1.5*math.cos(math.rad(90/10*math.min(Datos.Timer - Datos.WarnTime - (20 + 6*Datos.Bullets), 10))),1.5*math.cos(math.rad(90/10*math.min(Datos.Timer - Datos.WarnTime - (20 + 6*Datos.Bullets), 10))))
					if Datos.Timer - Datos.WarnTime - (20 + 6*Datos.Bullets) >= 10 then
						Datos.Bullet.Remove()
						Datos.Bullet = nil
						Datos = nil
						table.remove(GlitchesSpiral, i - tableaux)
						tableaux = tableaux + 1
					end
				end
			end
		end
		tableaux = 0
		for i=1,#Manos do
			local Datos = Manos[i - tableaux]
			if not Datos.Timer then
				Datos.Timer = 0
			end
			Datos.Timer = Datos.Timer + 1
			Datos.Bullet.sprite.rotation = Datos.Rotation
			Datos.Bullet.MoveToAbs(Datos.X + Datos.MovimientoX.Longitud*math.sin(math.rad(360/Datos.MovimientoX.Duracion*Datos.Timer)), Datos.Y + Datos.MovimientoY.Longitud*math.sin(math.rad(360/Datos.MovimientoY.Duracion*Datos.Timer)))
			if Datos.Warning then
				if not Datos.AuxW then
					Datos.AuxW = 0
					Datos.SpriteWarn = CreateSprite("Pixel","BelowPlayer")
					Datos.SpriteWarn.Scale(1000, 16)
				end
				Datos.AuxW = Datos.AuxW + 1
				Datos.SpriteWarn.MoveTo(Datos.Bullet.absx + 500*math.cos(math.rad(Datos.Rotation)), Datos.Bullet.absy + 500*math.sin(math.rad(Datos.Rotation)))
				Datos.SpriteWarn.rotation = Datos.Rotation
				Datos.SpriteWarn.alpha = (0.65 - 0.35*math.cos(math.rad(180/10*Datos.AuxW)))/5
			elseif Datos.SpriteWarn then
				Datos.SpriteWarn.Remove()
				Datos.SpriteWarn = nil
				Datos.AuxW = nil
			end
			if Datos.Generar then
				if not Datos.AuxG then
					Datos.AuxG = 0
				end
				Datos.AuxG = Datos.AuxG + 1
				Datos.Bullet.sprite.Scale(1 + 0.2*math.sin(math.rad(180/6*math.min(Datos.AuxG, 6))), 1 + 0.2*math.sin(math.rad(180/6*math.min(Datos.AuxG, 6))))
				if Datos.AuxG == 6 then
					for i=1,Datos.Generar do
						table.insert(Windings, {Bullet = CreateProjectileAbs("Gaster Level/Misiles/wingdings/"..Letters[math.random(#Letters)], Datos.Bullet.absx, Datos.Bullet.absy), Direction = Datos.Rotation + math.random(-30, 30), Vel = 3})
					end
					Datos.Generar = nil
					Datos.AuxG = nil
				end
			end
			if Datos.Spam then
				if not Datos.Aux then
					Datos.Aux = 0
					Datos.Limite = 3
				end
				Datos.Aux = Datos.Aux + 1
				Datos.Bullet.sprite.Scale(1 + 0.1*math.sin(math.rad(180/6*math.min(Datos.Aux, Datos.Limite))), 1 + 0.1*math.sin(math.rad(180/6*math.min(Datos.Aux, Datos.Limite))))
				if Datos.Aux >= 3 and not Datos.Detener then
					Datos.Bullet.sprite.rotation = Datos.Rotation + math.random(-4, 4)
					if Datos.Aux%6 == 3 then
						table.insert(Windings, {Bullet = CreateProjectileAbs("Gaster Level/Misiles/wingdings/"..Letters[math.random(#Letters)], Datos.Bullet.absx, Datos.Bullet.absy), Direction = Datos.Rotation, Vel = 12})
						table.insert(Windings, {Bullet = CreateProjectileAbs("Gaster Level/Misiles/wingdings/"..Letters[math.random(#Letters)], Datos.Bullet.absx, Datos.Bullet.absy), Direction = Datos.Rotation, Vel = 11})
						table.insert(Windings, {Bullet = CreateProjectileAbs("Gaster Level/Misiles/wingdings/"..Letters[math.random(#Letters)], Datos.Bullet.absx, Datos.Bullet.absy), Direction = Datos.Rotation, Vel = 10})
						table.insert(Windings, {Bullet = CreateProjectileAbs("Gaster Level/Misiles/wingdings/"..Letters[math.random(#Letters)], Datos.Bullet.absx, Datos.Bullet.absy), Direction = Datos.Rotation, Vel = 9})
					end
				elseif Datos.Limite == 3 and Datos.Detener then
					Datos.Limite = 6
					Datos.Aux = 3
				elseif Datos.Limite == 6 and Datos.Aux >= 6 then
					Datos.Aux = nil
					Datos.Limite = nil
					Datos.Spam = nil
				end
			end
		end
		tableaux = 0
		for i=1,#Circulo do
			local Datos = Circulo[i - tableaux]
			if not Datos.Timer then
				Datos.Timer = 0
			end
			Datos.Timer = Datos.Timer + 1
			Datos.Rotation = Datos.Rotation + Datos.Vel
			Datos.Sprite.MoveTo(Datos.Centro.X - (Datos.Longitud + Datos.Movimiento.Longitud*math.sin(math.rad(360/Datos.Movimiento.Duracion*Datos.Timer)))*math.sin(math.rad(Datos.Rotation)), Datos.Centro.Y + (Datos.Longitud + Datos.Movimiento.Longitud*math.sin(math.rad(360/Datos.Movimiento.Duracion*Datos.Timer)))*math.cos(math.rad(Datos.Rotation)))
			Datos.Sprite.rotation = Datos.Rotation + 180
			Datos.Sprite.color = Datos.Color
			if Datos.Warning then
				if not Datos.AuxW then
					Datos.AuxW = 0
					Datos.SpriteWarn = CreateSprite("Pixel","BelowPlayer")
					Datos.SpriteWarn.Scale(16, 1000)
				end
				Datos.AuxW = Datos.AuxW + 1
				Datos.Color = {0.65 - 0.35*math.cos(math.rad(180/10*Datos.AuxW)), 0.65 - 0.35*math.cos(math.rad(180/10*Datos.AuxW)), 0.65 - 0.35*math.cos(math.rad(180/10*Datos.AuxW))}
				Datos.SpriteWarn.MoveTo(Datos.Centro.X - (Datos.Longitud + Datos.Movimiento.Longitud*math.sin(math.rad(360/Datos.Movimiento.Duracion*Datos.Timer)))*math.sin(math.rad(Datos.Rotation)) + 500*math.sin(math.rad(Datos.Rotation)), Datos.Centro.Y + (Datos.Longitud + Datos.Movimiento.Longitud*math.sin(math.rad(360/Datos.Movimiento.Duracion*Datos.Timer)))*math.cos(math.rad(Datos.Rotation)) - 500*math.cos(math.rad(Datos.Rotation)))
				Datos.SpriteWarn.rotation = Datos.Rotation
				Datos.SpriteWarn.alpha = Datos.Color[1]/10
			elseif Datos.SpriteWarn then
				Datos.SpriteWarn.Remove()
				Datos.SpriteWarn = nil
				Datos.AuxW = nil
			end
			if Datos.Generar then
				if not Datos.Aux then
					Datos.Aux = 0
				end
				Datos.Aux = Datos.Aux + 1
				Datos.Sprite.Scale(1 + 0.1*math.sin(math.rad(180/6*math.min(Datos.Aux, 6))), 1 + 0.1*math.sin(math.rad(180/6*math.min(Datos.Aux, 6))))
				Datos.Color = {0.3 + 0.7*math.sin(math.rad(180/6*math.min(Datos.Aux, 6))), 0.3 + 0.7*math.sin(math.rad(180/6*math.min(Datos.Aux, 6))), 0.3 + 0.7*math.sin(math.rad(180/6*math.min(Datos.Aux, 6)))}
				if Datos.Aux == 6 then
					local diff = 360/Datos.Generar
					local current = math.random(360)
					for i=1,Datos.Generar do
						current = current + diff
						table.insert(Windings, {Bullet = CreateProjectileAbs("Gaster Level/Misiles/wingdings/"..Letters[math.random(#Letters)], Datos.Sprite.x, Datos.Sprite.y), Direction = current, Vel = 3})
					end
					Datos.Generar = nil
					Datos.Aux = nil
				end
			end
			if Datos.Spam then
				if not Datos.Aux then
					Datos.Aux = 0
					Datos.Limite = 3
				end
				Datos.Aux = Datos.Aux + 1
				Datos.Sprite.Scale(1 + 0.1*math.sin(math.rad(180/6*math.min(Datos.Aux, Datos.Limite))), 1 + 0.1*math.sin(math.rad(180/6*math.min(Datos.Aux, Datos.Limite))))
				Datos.Color = {0.3 + 0.7*math.sin(math.rad(180/6*math.min(Datos.Aux, Datos.Limite))), 0.3 + 0.7*math.sin(math.rad(180/6*math.min(Datos.Aux, Datos.Limite))), 0.3 + 0.7*math.sin(math.rad(180/6*math.min(Datos.Aux, Datos.Limite)))}
				if Datos.Aux >= 3 and not Datos.Detener then
					Datos.Sprite.rotation = Datos.Rotation + 180 + math.random(-4, 4)
					if Datos.Aux%6 == 3 then
						table.insert(Windings, {Bullet = CreateProjectileAbs("Gaster Level/Misiles/wingdings/"..Letters[math.random(#Letters)], Datos.Sprite.x, Datos.Sprite.y), Direction = Datos.Rotation - 90, Vel = 6})
					end
				elseif Datos.Limite == 3 and Datos.Detener then
					Datos.Limite = 6
					Datos.Aux = 3
				elseif Datos.Limite == 6 and Datos.Aux >= 6 then
					Datos.Aux = nil
					Datos.Limite = nil
					Datos.Spam = nil
				end
			end
		end
		tableaux = 0
		for i=1,#Glitches do
			local Datos = Glitches[i - tableaux]
			if not Datos.Timer then
				Datos.Timer = 0
				Datos.Bullet.sprite.alpha = 0
			end
			Datos.Timer = Datos.Timer + 1
			if Datos.Timer%9 == 3 then
				Datos.Bullet.sprite.Set("Gaster Level/Misiles/Distortion/1")
			elseif Datos.Timer%9 == 6 then
				Datos.Bullet.sprite.Set("Gaster Level/Misiles/Distortion/2")
			elseif Datos.Timer%9 == 0 then
				Datos.Bullet.sprite.Set("Gaster Level/Misiles/Distortion/3")
			end
			if Datos.Timer < Datos.WarnTime then
				Datos.Bullet.sprite.alpha = 0.5*Datos.Timer/Datos.WarnTime
			else
				Datos.Bullet.sprite.alpha = 0.5 + 0.5/6*(Datos.Timer - Datos.WarnTime)
				Datos.Bullet.sprite.Scale(1 + 0.3*math.sin(math.rad(180/6*math.min(Datos.Timer - Datos.WarnTime, 6))),1 + 0.3*math.sin(math.rad(180/6*math.min(Datos.Timer - Datos.WarnTime, 6))))
				if (Datos.Timer - Datos.WarnTime) == 6 then
					local diff = 360/Datos.Bullets
					local current = math.random(360)
					for i=1,Datos.Bullets do
						current = current + diff
						table.insert(Windings, {Bullet = CreateProjectileAbs("Gaster Level/Misiles/wingdings/"..Letters[math.random(#Letters)], Datos.Bullet.absx, Datos.Bullet.absy), Direction = current, Vel = 3})
					end
				elseif (Datos.Timer - Datos.WarnTime) >= 26 then
					Datos.Bullet.sprite.Scale(1*math.cos(math.rad(90/10*math.min(Datos.Timer - Datos.WarnTime - 26, 10))),1*math.cos(math.rad(90/10*math.min(Datos.Timer - Datos.WarnTime - 26, 10))))
					if Datos.Timer - Datos.WarnTime - 26 >= 10 then
						Datos.Bullet.Remove()
						Datos.Bullet = nil
						Datos = nil
						table.remove(Glitches, i - tableaux)
						tableaux = tableaux + 1
					end
				end
			end
		end
		tableaux = 0
		for i=1,#Windings do
			local Datos = Windings[i - tableaux]
			if not Datos.X then
				Datos.X = Datos.Bullet.absx
			end
			if not Datos.Y then
				Datos.Y = Datos.Bullet.absy
			end
			if not Datos.Vel then
				Datos.Vel = 4
			end
			if Datos.Acceleration then
				Datos.Vel = Datos.Vel*1.01
			end
			Datos.X = Datos.X + Datos.Vel*math.cos(math.rad(Datos.Direction))
			Datos.Y = Datos.Y + Datos.Vel*math.sin(math.rad(Datos.Direction))
			Datos.Bullet.MoveToAbs(Datos.X + math.random(-2,2), Datos.Y + math.random(-2,2))
			if (Datos.Bullet.absx < -10 or Datos.Bullet.absx > 650 or Datos.Bullet.absy < -10 or Datos.Bullet.absy > 490) and not Datos.Special then
				Datos.Bullet.Remove()
				Datos.Bullet = nil
				Datos = nil
				table.remove(Windings, i - tableaux)
				tableaux = tableaux + 1
			elseif (Datos.Bullet.absx < -160 or Datos.Bullet.absx > 800 or Datos.Bullet.absy < -160 or Datos.Bullet.absy > 640) and Datos.Special then
				Datos.Bullet.Remove()
				Datos.Bullet = nil
				Datos = nil
				table.remove(Windings, i - tableaux)
				tableaux = tableaux + 1
			end
		end
		tableaux = 0
		for i=1,#Hands do
			local Datos = Hands[i - tableaux]
			if not Datos.Timer then
				Datos.Timer = 0
			end
			Datos.Bullet.sprite.rotation = Datos.Rotation + math.random(-4, 4)
			Datos.Timer = Datos.Timer + 1
			if Datos.Aim == "Y" then
				if Datos.Location == "Left" then
					Datos.Bullet.MoveToAbs(10, PosY)
					if Datos.Timer%Datos.SpawnTimer == 1 and Datos.Timer > 0 and not Datos.Stop then
						for i=1,Datos.Bullets do
							table.insert(Windings, {Bullet = CreateProjectileAbs("Gaster Level/Misiles/wingdings/"..Letters[math.random(#Letters)], 10, Datos.Bullet.absy), Direction = math.random(-30, 30), Vel = math.random(2,4)})
						end
					end
				elseif Datos.Location == "Right" then
					Datos.Bullet.MoveToAbs(630, PosY)
					if Datos.Timer%Datos.SpawnTimer == 1 and Datos.Timer > 0 and not Datos.Stop then
						for i=1,Datos.Bullets do
							table.insert(Windings, {Bullet = CreateProjectileAbs("Gaster Level/Misiles/wingdings/"..Letters[math.random(#Letters)], 630, Datos.Bullet.absy), Direction = math.random(150, 210), Vel = math.random(2,4)})
						end
					end
				end
			elseif Datos.Aim == "X" then
				if Datos.Location == "Up" then
					Datos.Bullet.MoveToAbs(PosX, 470)
					if Datos.Timer%Datos.SpawnTimer == 1 and Datos.Timer > 0 and not Datos.Stop then
						for i=1,Datos.Bullets do
							table.insert(Windings, {Bullet = CreateProjectileAbs("Gaster Level/Misiles/wingdings/"..Letters[math.random(#Letters)], Datos.Bullet.absx, 470), Direction = math.random(240, 300), Vel = math.random(2,4)})
						end
					end
				elseif Datos.Location == "Down" then
					Datos.Bullet.MoveToAbs(PosX, 10)
					if Datos.Timer%Datos.SpawnTimer == 1 and Datos.Timer > 0 and not Datos.Stop then
						for i=1,Datos.Bullets do
							table.insert(Windings, {Bullet = CreateProjectileAbs("Gaster Level/Misiles/wingdings/"..Letters[math.random(#Letters)], Datos.Bullet.absx, 10), Direction = math.random(60, 120), Vel = math.random(2,4)})
						end
					end
				end
			end
			if Datos.Stop then
				if (Datos.Timer - Datos.Stop) <= 4 then
					Datos.Bullet.sprite.Scale(1 + 0.2*math.sin(math.rad(90/4*(Datos.Timer - Datos.Stop))), 1 + 0.2*math.sin(math.rad(90/4*(Datos.Timer - Datos.Stop))))
				elseif (Datos.Timer - Datos.Stop) > 4 then
					Datos.Bullet.sprite.Scale(1.2 - 1.2*math.sin(math.rad(90/10*(Datos.Timer - Datos.Stop - 4))), 1.2 - 1.2*math.sin(math.rad(90/10*(Datos.Timer - Datos.Stop - 4))))
					if Datos.Bullet.sprite.yscale <= 0 then
						Datos.Bullet.Remove()
						Datos.Bullet = nil
						Datos = nil
						table.remove(Hands, i - tableaux)
						tableaux = tableaux + 1
					end
				end
			end
		end
		tableaux = 0
		if Input.Up > 0 and Input.Down == 0 then
			if Invertir == "Y" or Invertir == "All" then
				PosY = math.min(PosY - 4, 472)
			else
				PosY = math.min(PosY + 4, 472)
			end
		elseif Input.Down > 0 and Input.Up == 0 then
			if Invertir == "Y" or Invertir == "All" then
				PosY = math.max(PosY + 4, 8)
			else
				PosY = math.max(PosY - 4, 8)
			end
		end
		if Input.Right > 0 and Input.Left == 0 then
			if Invertir == "X" or Invertir == "All" then
				PosX = math.min(PosX - 4, 632)
			else
				PosX = math.min(PosX + 4, 632)
			end
		elseif Input.Left > 0 and Input.Right == 0 then
			if Invertir == "X" or Invertir == "All" then
				PosX = math.max(PosX + 4, 8)
			else
				PosX = math.max(PosX - 4, 8)
			end
		end
		Player.MoveToAbs(PosX, PosY, false)
		if Numbers and Numbers[1].isactive and Numbers[2].isactive then
			HPUpdate()
		end
		BlackD.SendToTop()
		if Input.GetKey("P") == 1 then
			Pause = 0
			if not NewAudio.isStopped("Song") then
				Detenido = true
				NewAudio.Pause("Song")
			end
			if not NewAudio.isStopped("Gaster") then
				Detenido2 = true
				NewAudio.Pause("Gaster")
			end
		end
	else
		if Pause == 0 then
			if not Text and not Option1 and not Option2 then
				Text = CreateSprite("Menu/Pausa","Top")
				Option1 = CreateSprite("Menu/Continuar","Top")
				Option2 = CreateSprite("Menu/Quitar","Top")
				Text.MoveTo(320, 260)
				Option1.MoveTo(170, 200)
				Option2.MoveTo(470, 200)
			end
			BlackD.alpha = BlackD.alpha + 0.02
			Text.alpha = BlackD.alpha*2
			Option1.alpha = BlackD.alpha*2
			Option2.alpha = BlackD.alpha*2
			if BlackD.alpha >= 0.5 then
				Pause = 1
				Audio.PlaySound("pip")
			end
		elseif Pause == 1 then
			Option1.color = {1,1,0}
			Option2.color = {1,1,1}
			if Input.Right == 1 then
				Pause = 2
				Audio.PlaySound("pip")
			elseif Input.Confirm == 1 then
				Audio.PlaySound("confirm")
				Option1.color = {1,1,1}
				Option2.color = {1,1,1}
				Pause = 3
			end
		elseif Pause == 2 then
			Option1.color = {1,1,1}
			Option2.color = {1,1,0}
			if Input.Left == 1 then
				Pause = 1
				Audio.PlaySound("pip")
			elseif Input.Confirm == 1 then
				Audio.PlaySound("confirm")
				Option1.color = {1,1,1}
				Option2.color = {1,1,1}
				Pause = 4
			end
		elseif Pause == 3 then
			BlackD.alpha = BlackD.alpha - 0.02
			Text.alpha = BlackD.alpha*2
			Option1.alpha = BlackD.alpha*2
			Option2.alpha = BlackD.alpha*2
			if BlackD.alpha <= 0 then
				Text.Remove()
				Option1.Remove()
				Option2.Remove()
				Text = nil
				Option1 = nil
				Option2 = nil
				if Detenido then
					NewAudio.Unpause("Song")
					Detenido = nil
				end
				if Detenido2 then
					NewAudio.Unpause("Gaster")
					Detenido2 = nil
				end
				Pause = nil
			end
		elseif Pause == 4 then
			BlackD.alpha = BlackD.alpha + 0.02
			Text.alpha = Text.alpha - 0.04
			Option1.alpha = Text.alpha
			Option2.alpha = Text.alpha
			if BlackD.alpha >= 1 then
				if not wait2 then
					wait2 = 0
				end
				wait2 = wait2 + 1
				if wait2 == 60 then
					Text.Remove()
					Option1.Remove()
					Option2.Remove()
					Text = nil
					Option1 = nil
					Option2 = nil
					Pause = 5
					EndAll = true
				end
			end
		end
	end
	if EndAll then
		RemoveAll()
		if Black then
			Black.Remove()
		end
		BlackD.Remove()
		CuerpoG.Remove()
		CabezaG.Remove()
		Distortion.Remove()
		CabezaD.Remove()
		NewAudio.Stop("Gaster")
		NewAudio.Stop("Song")
		NewAudio.DestroyChannel("Gaster")
		NewAudio.DestroyChannel("Song")
		if TituloSong then
			TituloSong.Remove()
		end
		if VersionLevel then
			VersionLevel.Remove()
		end
		if Advice then
			Advice.Remove()
		end
		for i=1,#Warnings do
			Warnings[i - tableaux].Sprite.Remove()
			table.remove(Warnings, i - tableaux)
			tableaux = tableaux + 1
		end
		tableaux = 0
		for i=1,#Puños do
			if Puños[i - tableaux].Warning then
				Puños[i - tableaux].Warning.Remove()
			end
			table.remove(Puños, i - tableaux)
			tableaux = tableaux + 1
		end
		tableaux = 0
		for i=1,#PuñosSpam do
			if PuñosSpam[i - tableaux].Warning then
				PuñosSpam[i - tableaux].Warning.Remove()
			end
			table.remove(PuñosSpam, i - tableaux)
			tableaux = tableaux + 1
		end
		tableaux = 0
		for i=1,#Circulo do
			Circulo[i - tableaux].Sprite.Remove()
			if Circulo[i - tableaux].SpriteWarn then
				Circulo[i - tableaux].SpriteWarn.Remove()
			end
			table.remove(Circulo, i - tableaux)
			tableaux = tableaux + 1
		end
		tableaux = 0
		for i=1,#Manos do
			if Manos[i - tableaux].SpriteWarn then
				Manos[i - tableaux].SpriteWarn.Remove()
			end
			table.remove(Manos, i - tableaux)
			tableaux = tableaux + 1
		end
		tableaux = 0
		for i=1,#ManosSiguiendo do
			if ManosSiguiendo[i - tableaux].SpriteWarn then
				ManosSiguiendo[i - tableaux].SpriteWarn.Remove()
			end
			table.remove(ManosSiguiendo, i - tableaux)
			tableaux = tableaux + 1
		end
		tableaux = 0
		Encounter["nextwaves"] = {"MenuG"}
		State("ACTIONSELECT")
		State("DEFENDING")
	end
end

function OnHit(bullet)
	if bullet.sprite.alpha > 0.9 then
		if Player.hp > 1 then
			Player.Hurt(1)
		elseif not Player.isHurting then
			Player.Hurt(0)
			RemoveAll()
			CuerpoG.Remove()
			CabezaG.Remove()
			Distortion.Remove()
			CabezaD.Remove()
			Numbers[1].Remove()
			Numbers[2].Remove()
			NewAudio.Stop("Gaster")
			NewAudio.DestroyChannel("Gaster")
			for i=1,#Warnings do
				Warnings[i - tableaux].Sprite.Remove()
				table.remove(Warnings, i - tableaux)
				tableaux = tableaux + 1
			end
			tableaux = 0
			for i=1,#Puños do
				if Puños[i - tableaux].Warning then
					Puños[i - tableaux].Warning.Remove()
				end
				table.remove(Puños, i - tableaux)
				tableaux = tableaux + 1
			end
			tableaux = 0
			for i=1,#PuñosSpam do
				if PuñosSpam[i - tableaux].Warning then
					PuñosSpam[i - tableaux].Warning.Remove()
				end
				table.remove(PuñosSpam, i - tableaux)
				tableaux = tableaux + 1
			end
			tableaux = 0
			for i=1,#Circulo do
				Circulo[i - tableaux].Sprite.Remove()
				if Circulo[i - tableaux].SpriteWarn then
					Circulo[i - tableaux].SpriteWarn.Remove()
				end
				table.remove(Circulo, i - tableaux)
				tableaux = tableaux + 1
			end
			tableaux = 0
			for i=1,#Manos do
				if Manos[i - tableaux].SpriteWarn then
					Manos[i - tableaux].SpriteWarn.Remove()
				end
				table.remove(Manos, i - tableaux)
				tableaux = tableaux + 1
			end
			tableaux = 0
			for i=1,#ManosSiguiendo do
				if ManosSiguiendo[i - tableaux].SpriteWarn then
					ManosSiguiendo[i - tableaux].SpriteWarn.Remove()
				end
				table.remove(ManosSiguiendo, i - tableaux)
				tableaux = tableaux + 1
			end
			tableaux = 0
			Encounter["nextwaves"] = {"Undertale Game Over G"}
			State("ACTIONSELECT")
			State("DEFENDING")
		end
	end
end